Skip to content

Commit

Permalink
FIx same issue with single page #8583
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Jul 19, 2024
1 parent 775e149 commit 917386d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4297,7 +4297,7 @@ export class SurveyModel extends SurveyElementCore
private isLockingUpdateOnPageModes: boolean;
private setupPagesForPageModes(isSinglePage: boolean, isFirstLoad: boolean) {
this.questionHashesClear();
if(!isSinglePage && this.firstPageIsStarted && this.pages.length > 0) {
if(this.firstPageIsStarted && this.pages.length > 0) {
this.pages[0].questions.forEach(q => this.questionHashesAdded(q));
}
this.isLockingUpdateOnPageModes = !isFirstLoad;
Expand Down
21 changes: 21 additions & 0 deletions tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20266,6 +20266,27 @@ QUnit.test("Question is not in the hash with it is on the first page & questions
"questionsOnPageMode": "questionPerPage",
});

const q = survey.getQuestionByName("q1");
assert.equal(q.name, "q1", "q1 name is here");
});
QUnit.test("Question is not in the hash with it is on the first page & questionsOnPageMode is 'singlePage', Bug#8583", function (assert) {
const survey = new SurveyModel({
"pages": [{
"elements": [{
"type": "text",
"name": "q1"
}
]
},
{
"elements": [{
"type": "text",
"name": "q2"
}] }],
"firstPageIsStarted": true,
"questionsOnPageMode": "singlePage",
});

const q = survey.getQuestionByName("q1");
assert.equal(q.name, "q1", "q1 name is here");
});

0 comments on commit 917386d

Please sign in to comment.