Skip to content

Commit

Permalink
"questionsOnPageMode": "questionPerPage" doesn't work correctly with …
Browse files Browse the repository at this point in the history
…skip trigger fix #9276 (#9277)
  • Loading branch information
andrewtelnov authored Jan 9, 2025
1 parent 0a8beff commit 56252ab
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/survey-core/src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7933,6 +7933,9 @@ export class SurveyModel extends SurveyElementCore
const isNeedWaitForPageRendered = this.activePage !== question.page && !question.page.isStartPage;
if (isNeedWaitForPageRendered) {
this.currentPage = <PageModel>question.page;
if(this.isSingleVisibleQuestion && !this.isDesignMode) {
this.currentSingleQuestion = question;
}
}
if (!isNeedWaitForPageRendered) {
this.focusQuestionInfo();
Expand Down
30 changes: 30 additions & 0 deletions packages/survey-core/tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19498,6 +19498,36 @@ QUnit.test("survey.toJSON() doesn't work correctly if questionsOnPageMode=questi

assert.deepEqual(surveyJson, prepareJSON);
});
QUnit.test("questionsOnPageMode=questionPerPage & skip doesn't work correctly, Bug #9276", function (assert) {
const surveyJson = {
"questionsOnPageMode": "questionPerPage",
"pages": [
{
"elements": [
{ "type": "text", "name": "q1" },
{ "type": "text", "name": "q2" }
]
},
{
"elements": [
{ "type": "text", "name": "q3" },
{ "type": "text", "name": "q4" }
]
}
],
"triggers": [
{
"type": "skip",
"expression": "{q1} = 'a'",
"gotoName": "q4"
}]
};

const survey = new SurveyModel(surveyJson);
assert.equal(survey.currentSingleQuestion.name, "q1", "#1");
survey.currentSingleQuestion.value = "a";
assert.equal(survey.currentSingleQuestion.name, "q4", "#2");
});
QUnit.test("defaultValue & visibleIf issues if questionsOnPageMode=questionPerPage is used #7932", function (assert) {
const surveyJson = {
elements: [
Expand Down

0 comments on commit 56252ab

Please sign in to comment.