Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panel running animations on first rendering when questionPerPage is set #8267

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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;
});
Loading