Skip to content

Commit

Permalink
Fix panel running animations on first rendering when questionPerPage …
Browse files Browse the repository at this point in the history
…is set (#8267)
  • Loading branch information
dk981234 committed May 14, 2024
1 parent 79534b4 commit f2a6ed1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/survey-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ export class SurveyElement<E = any> extends SurveyElementCore implements ISurvey
return !!this._renderedIsExpanded;
}
protected getIsAnimationAllowed(): boolean {
return super.getIsAnimationAllowed() && !!this.survey;
return super.getIsAnimationAllowed() && !!this.survey && !(this.survey as SurveyModel)["isEndLoadingFromJson"];
}

public dispose(): void {
Expand Down
30 changes: 30 additions & 0 deletions tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19599,3 +19599,33 @@ QUnit.test("showPreview & dynamic panel? single page", function (
assert.notOk((survey.getQuestionByName("question1") as QuestionPanelDynamicModel).panels[0].showPanelAsPage);
});

QUnit.test("check panel's visibleRows are updated sync when running condidtions after loading from json", (assert) => {
settings.animationEnabled = true;
const survey = new SurveyModel({
"elements": [
{
"type": "panel",
"name": "nps-panel",
"elements": [
{
"type": "rating",
"name": "nps-score",
"rateMin": 0,
"rateMax": 10,
},
{
"type": "comment",
"name": "disappointing-experience",
"visibleIf": "{nps-score} <= 5",
},
]
},
],
"showQuestionNumbers": false,
"questionsOnPageMode": "questionPerPage"
});
const panel = survey.getPanelByName("nps-panel");
assert.equal(panel.visibleRows.length, 1);
assert.equal(panel.visibleRows[0].visibleElements[0].name, "nps-score");
settings.animationEnabled = false;
});

0 comments on commit f2a6ed1

Please sign in to comment.