Skip to content

Commit

Permalink
Impossible to set the default rowTitleWidth property value for all ma…
Browse files Browse the repository at this point in the history
…trix question types fix #7228 (#7234)
  • Loading branch information
andrewtelnov committed Oct 26, 2023
1 parent 9c24564 commit 11de907
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/martixBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export class QuestionMatrixBaseModel<TRow, TColumn> extends Question {
* @see width
*/
public get columnMinWidth(): string {
return this.getPropertyValue("columnMinWidth", "");
return this.getPropertyValue("columnMinWidth") || "";
}
public set columnMinWidth(val: string) {
this.setPropertyValue("columnMinWidth", val);
Expand All @@ -336,7 +336,7 @@ export class QuestionMatrixBaseModel<TRow, TColumn> extends Question {
* A width for the column that displays row titles (first column). Accepts CSS values.
*/
public get rowTitleWidth(): string {
return this.getPropertyValue("rowTitleWidth", "");
return this.getPropertyValue("rowTitleWidth") || "";
}
public set rowTitleWidth(val: string) {
this.setPropertyValue("rowTitleWidth", val);
Expand Down
9 changes: 9 additions & 0 deletions tests/jsonobjecttests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3006,4 +3006,13 @@ QUnit.test("load matrix column, visible property", function (assert) {
column.fromJSON({ title: "column1", visible: false });
assert.equal(column.title, "column1", "set column title correctly");
assert.equal(column.visible, false, "column.visible is false");
});
QUnit.test("defaultValue for matrix rowTitleWidth and columnMinWidth properties", function (assert) {
Serializer.findProperty("matrix", "rowTitleWidth").defaultValue = "110px";
Serializer.findProperty("matrix", "columnMinWidth").defaultValue = "220px";
const matrix = new QuestionMatrixModel("q1");
assert.equal(matrix.rowTitleWidth, "110px", "rowTitleWidth");
assert.equal(matrix.columnMinWidth, "220px", "columnMinWidth");
Serializer.findProperty("matrix", "rowTitleWidth").defaultValue = undefined;
Serializer.findProperty("matrix", "columnMinWidth").defaultValue = undefined;
});

0 comments on commit 11de907

Please sign in to comment.