Skip to content

Commit

Permalink
panelsState property doesn't work in panel dynamic with pipe answers fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov authored Aug 6, 2024
1 parent 7804208 commit ac44487
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/question_paneldynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ export class QuestionPanelDynamicModel extends Question
const panel = this.createNewPanel();
this.panelsCore.push(panel);
if (this.renderMode == "list" && this.panelsState != "default") {
if (this.panelsState === "expand") {
if (this.panelsState === "expanded") {
panel.expand();
} else {
if (!!panel.title) {
Expand Down
36 changes: 36 additions & 0 deletions tests/question_paneldynamic_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7069,6 +7069,42 @@ QUnit.test("panel dynamic & panel visibleIf & checkbox vs carry forward, #7693",
});
});

QUnit.test("paneldynamic: panelsState & valueName Bug#8653", function (assert) {
const survey = new SurveyModel({
elements: [
{
"type": "checkbox",
"name": "state_names",
"title": "States",
"valuePropertyName": "state_name",
"choices": ["ACT", "NSW", "QLD"]
},
{
"type": "paneldynamic",
"name": "regions",
"valueName": "state_names",
"allowAddPanel": false,
"allowRemovePanel": false,
"visibleIf": "{state_names} notempty",
"panelsState": "expanded",
"templateTitle": "Regions for State {panel.state_name}",
"templateElements": [
{
"type": "text",
"name": "q1"
}
]
}
]
});
const checkbox = <QuestionCheckboxModel>survey.getQuestionByName("state_names");
const panel = <QuestionPanelDynamicModel>survey.getQuestionByName("regions");
checkbox.selectAll();
assert.equal(panel.visiblePanels.length, 3, "3 panels have been created");
assert.equal(panel.visiblePanels[0].state, "expanded", "panels[0] state is expanded");
assert.equal(panel.visiblePanels[1].state, "expanded", "panels[1] state is expanded");
assert.equal(panel.visiblePanels[2].state, "expanded", "panels[2] state is expanded");
});
QUnit.test("paneldynamic: check renderedPanels", function (assert) {
const survey = new SurveyModel({
elements: [
Expand Down

0 comments on commit ac44487

Please sign in to comment.