Skip to content

Commit

Permalink
choicesMin&choicesMax properties do not work for dropdowns in the mat…
Browse files Browse the repository at this point in the history
…rix detail panel fix #7420 (#7421)
  • Loading branch information
andrewtelnov committed Nov 24, 2023
1 parent 4069ea6 commit 988b3fb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/question_matrixdropdownbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2355,6 +2355,7 @@ export class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel<Mat
this.onCreateDetailPanelCallback(row, panel);
}
panel.questions.forEach(q => q.setParentQuestion(this));
panel.onSurveyLoad();
return panel;
}
getSharedQuestionByName(
Expand Down
37 changes: 37 additions & 0 deletions tests/question_matrixdropdownbasetests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Serializer } from "../src/jsonobject";
import { QuestionDropdownModel } from "../src/question_dropdown";
import { QuestionMatrixDropdownModelBase } from "../src/question_matrixdropdownbase";
import { MatrixDropdownColumn } from "../src/question_matrixdropdowncolumn";
import { SurveyModel } from "../src/survey";
Expand Down Expand Up @@ -1005,4 +1006,40 @@ QUnit.test("checkIfValueInRowDuplicated has only one duplicated error", function
});
const matrix = <QuestionMatrixDropdownModelBase>survey.getQuestionByName("matrix");
assert.equal(matrix.columns.length, 1, "There is one column, it is loaded correctly");
});
QUnit.test("checkIfValueInRowDuplicated has only one duplicated error", function (assert) {
const survey = new SurveyModel({
"elements": [
{
"type": "matrixdynamic",
"name": "matrix",
"rowCount": 1,
"columns": [
{
"name": "col1",
"cellType": "dropdown",
"choices": ["a", "b"],
"choicesMin": 1,
"choicesMax": 10
}
],
detailPanelMode: "underRow",
detailElements: [{
"name": "q1",
"type": "dropdown",
"choices": ["a", "b"],
"choicesMin": 1,
"choicesMax": 10
}],
}
]
});
const matrix = <QuestionMatrixDropdownModelBase>survey.getQuestionByName("matrix");
const row = matrix.visibleRows[0];
const cellQuestion = <QuestionDropdownModel>row.cells[0].question;
row.showDetailPanel();
const panelQuestion = <QuestionDropdownModel>row.detailPanel.questions[0];
assert.equal(panelQuestion.choicesMin, 1, "choicesMin is here");
assert.equal(panelQuestion.choicesMax, 10, "choicesMax is here");
assert.equal(panelQuestion.visibleChoices.length, 12, "cell question visibleChoices");
});

0 comments on commit 988b3fb

Please sign in to comment.