Skip to content

Commit

Permalink
Page Conditional Visibility doesn't work when the first page is a sta…
Browse files Browse the repository at this point in the history
…rting page fix #9520 (#9523)
  • Loading branch information
andrewtelnov committed Feb 26, 2025
1 parent d42cfba commit 83dc9d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/survey-core/src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4809,6 +4809,7 @@ export class SurveyModel extends SurveyElementCore
this.startTimerFromUI();
this.onStarted.fire(this, {});
this.updateVisibleIndexes();
this.currentPageNo = 0;
if (!!this.currentPage) {
this.currentPage.locStrsChanged();
}
Expand Down
15 changes: 14 additions & 1 deletion packages/survey-core/tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21286,7 +21286,20 @@ QUnit.test("Check questionsOnPageMode is 'singlePage' & showPreview", function (
assert.equal(survey.visiblePages[0].name, "single-page", "The name is single-page, #2");
assert.equal(survey.visiblePages[0].id, singlePageId, "We do not re-create the single-page, #2");
});

QUnit.test("The Start Page & changing the question visibility, Bug#9520", function (assert) {
const survey = new SurveyModel({
pages: [
{ elements: [{ type: "text", name: "q1" }] },
{ name: "p1", visibleIf: "{q1}='a'", elements: [{ type: "text", name: "q2" }] },
{ name: "p2", elements: [{ type: "text", name: "q1" }] }
],
firstPageIsStarted: true,
});
assert.equal(survey.visiblePages.length, 1, "visiblePages #1");
survey.setValue("q1", "a");
survey.start();
assert.equal(survey.currentPage.name, "p1", "p1 is the current page");
});
QUnit.test("The Start Page has -1 index when enabling auto-numeration for survey pages, Bug#8983", function (assert) {
const survey = new SurveyModel({
"pages": [{
Expand Down

0 comments on commit 83dc9d5

Please sign in to comment.