Skip to content

Commit

Permalink
Single-Choice Matrix doesn't display values in read-only/display mode f…
Browse files Browse the repository at this point in the history
…ix #7719 (#7730)
  • Loading branch information
andrewtelnov authored Jan 25, 2024
1 parent e93068a commit c94d452
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/question_matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class MatrixRowModel extends Base {
) {
super();
this.data = data;
this.value = value;
this.setValueDirectly(value);
this.cellClick = (column: any) => {
this.value = column.value;
};
Expand Down
12 changes: 12 additions & 0 deletions tests/surveyquestiontests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7560,3 +7560,15 @@ QUnit.test("Hide errors on making question disabled", function (assert) {
assert.equal(q2.isReadOnly, true, "q2 is read-only");
assert.equal(q2.errors.length, 0, "Clear errors on making questio read-only");
});
QUnit.test("matrix.visibleRows and read-only", function (assert) {
const survey = new SurveyModel({
elements: [
{ type: "matrix", name: "matrix", columns: ["col1", "col2"], rows: ["row1", "row2"], readOnly: true }
]
});
const matrix = <QuestionMatrixModel>survey.getQuestionByName("matrix");
matrix.value = { row1: "col1", row2: "col2" };
assert.equal(matrix.visibleRows.length, 2, "visibleRows.length");
assert.equal(matrix.visibleRows[0].value, "col1", "row1.value");
assert.equal(matrix.visibleRows[1].value, "col2", "row2.value");
});

0 comments on commit c94d452

Please sign in to comment.