From c56d2472308a673edd58fee514acbe6b22616b3d Mon Sep 17 00:00:00 2001 From: Dmitry Kuzin Date: Tue, 7 May 2024 15:51:00 +0400 Subject: [PATCH] Fix panel running animations on first rendering when questionPerPage is set --- src/survey-element.ts | 2 +- tests/surveytests.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/survey-element.ts b/src/survey-element.ts index 702efb7b95..d69bed1989 100644 --- a/src/survey-element.ts +++ b/src/survey-element.ts @@ -1120,7 +1120,7 @@ export class SurveyElement 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 { diff --git a/tests/surveytests.ts b/tests/surveytests.ts index f9be5225d7..ec67067ab8 100644 --- a/tests/surveytests.ts +++ b/tests/surveytests.ts @@ -19578,3 +19578,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; +}); \ No newline at end of file