Skip to content

Commit

Permalink
[v1.12.6] Multi-Select Matrix - The Edit Choices dialog doesn't updat…
Browse files Browse the repository at this point in the history
…e a column choices array fix #5976
  • Loading branch information
andrewtelnov committed Oct 24, 2024
1 parent e7952ee commit d4fe478
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/components/matrix-cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export class MatrixCellWrapperEditSurvey {
questionJSON[key] = !columnJSON[key];
}
}
if(column.cellType === "default") {
column.cellType = qType;
}
for(let key in questionJSON) {
if(!Helpers.isTwoValueEquals(questionJSON[key], columnJSON[key])) {
column[key] = questionJSON[key];
Expand Down
24 changes: 24 additions & 0 deletions packages/survey-creator-core/tests/question-editors.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,27 @@ test("Edit matrix cell question & showInMultipleColumns, #5750", (): any => {
expect(creator.propertyGrid.getQuestionByName("showNoneItem").value).toBeFalsy();
expect(matrix.columns[0].choices).toHaveLength(2);
});
test("Edit matrix cell question & default cellType, #5976", (): any => {
const creator = new CreatorTester();
creator.JSON = {
"elements": [
{
"type": "matrixdropdown",
"name": "q1",
"columns": [{ name: "column1" }],
"rows": ["row1", "row2"],
choices: [1, 2, 3, 4]
}
]
};
const matrix = <QuestionMatrixDropdownModel>creator.survey.getQuestionByName("q1");
creator.selectElement(matrix.columns[0]);
let question = matrix.visibleRows[0].cells[0].question;
let editSurvey = new MatrixCellWrapperEditSurvey(creator, question, matrix.columns[0]);
let editQuestion = <QuestionCheckboxModel>editSurvey.question;
expect(editQuestion.getType()).toEqual("dropdown");
editQuestion.choices = [1, 2];
editSurvey.apply();
expect(matrix.columns[0].cellType).toBe("dropdown");
expect(matrix.columns[0].choices).toHaveLength(2);
});

0 comments on commit d4fe478

Please sign in to comment.