Skip to content

Commit

Permalink
"questionsOnPageMode": "questionPerPage" doesn't work correctly in de…
Browse files Browse the repository at this point in the history
…signer fix #9274 (#9275)
  • Loading branch information
andrewtelnov authored Jan 9, 2025
1 parent 31401c5 commit 0a8beff
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/survey-core/src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4651,7 +4651,7 @@ export class SurveyModel extends SurveyElementCore
}
private changeCurrentPageFromPreview: boolean;
protected onQuestionsOnPageModeChanged(oldValue: string): void {
if (this.isShowingPreview) return;
if (this.isShowingPreview || this.isDesignMode) return;
this.currentSingleQuestion = undefined;
if(oldValue === "singlePage") {
this.updatePagesContainer();
Expand Down
23 changes: 23 additions & 0 deletions packages/survey-core/tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20742,6 +20742,29 @@ QUnit.test("Question is not in the hash with it is on the first page & questions
const q = survey.getQuestionByName("q1");
assert.equal(q.name, "q1", "q1 name is here");
});
QUnit.test("Do not use questionsOnPageMode in design-mode, Bug#9274", function (assert) {
const json = {
"pages": [{
"elements": [
{ "type": "text", "name": "q1" },
{ "type": "text", "name": "q2" }
]
},
{
"elements": [
{ "type": "text", "name": "q3" },
{ "type": "text", "name": "q4" }
]
}],
"questionsOnPageMode": "questionPerPage",
};
const survey = new SurveyModel();
survey.setDesignMode(true);
survey.fromJSON(json);
assert.equal(survey.questionsOnPageMode, "questionPerPage", "the property set correctly");
assert.equal(survey.currentSingleQuestion?.name, undefined, "It is the design mode");
});

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": [{
Expand Down

0 comments on commit 0a8beff

Please sign in to comment.