Skip to content

Commit

Permalink
Allow to set empty string to displayName property attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Feb 5, 2024
1 parent b483648 commit cd40e32
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jsonobject.ts
Expand Up @@ -819,7 +819,7 @@ export class JsonMetadataClass {
if (!Helpers.isValueEmpty(propInfo.maxLength)) {
prop.maxLength = propInfo.maxLength;
}
if (!Helpers.isValueEmpty(propInfo.displayName)) {
if (propInfo.displayName !== undefined) {
prop.displayName = propInfo.displayName;
}
if (!Helpers.isValueEmpty(propInfo.category)) {
Expand Down
13 changes: 13 additions & 0 deletions tests/jsonobjecttests.ts
Expand Up @@ -3264,3 +3264,16 @@ QUnit.test("Test showInMultipleColumns prop visibility", function (assert) {
assert.ok(prop, "property is here");
assert.equal(prop.isVisible("", column), true, "column is visible");
});
QUnit.test("Versions & alternative name", function (assert) {
const prop1 = Serializer.addProperty("question", { name: "testProperty1", displayName: "" });
const prop2 = Serializer.addProperty("question", { name: "testProperty2", displayName: undefined });
const prop3 = Serializer.addProperty("question", { name: "testProperty3" });

assert.strictEqual(prop1.displayName, "", "prop1");
assert.strictEqual(prop2.displayName, undefined, "prop2");
assert.strictEqual(prop3.displayName, undefined, "prop3");

Serializer.removeProperty("question", "testProperty1");
Serializer.removeProperty("question", "testProperty2");
Serializer.removeProperty("question", "testProperty3");
});

0 comments on commit cd40e32

Please sign in to comment.