Skip to content

Commit

Permalink
Merge pull request #8989 from surveyjs/bug/8982-question-progress
Browse files Browse the repository at this point in the history
Fixed #8982 - A bottom progress bar is not displayed when questionsOnPageMode is singlePage
  • Loading branch information
andrewtelnov authored Oct 30, 2024
2 parents 8b43371 + 063fb13 commit 544617a
Show file tree
Hide file tree
Showing 2 changed files with 28 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 @@ -7748,7 +7748,7 @@ export class SurveyModel extends SurveyElementCore
}
}
} else if (this.state === "running" && isStrCiEqual(layoutElement.id, this.progressBarComponentName)) {
if (this.questionsOnPageMode != "singlePage") {
if (this.questionsOnPageMode != "singlePage" || this.progressBarType == "questions") {
const headerLayoutElement = this.findLayoutElement("advanced-header");
const advHeader = headerLayoutElement && headerLayoutElement.data as Cover;
let isBelowHeader = !advHeader || advHeader.hasBackground;
Expand Down
27 changes: 27 additions & 0 deletions packages/survey-core/tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20405,6 +20405,7 @@ QUnit.test("getContainerContent - do not show buttons progress in the single pag
let survey = new SurveyModel(json);
const getContainerContent = getContainerContentFunction(survey);

assert.equal(survey.progressBarType, "pages");
assert.equal(survey.questionsOnPageMode, "standard");
assert.deepEqual(getContainerContent("header"), [], "");
assert.deepEqual(getContainerContent("center"), [{
Expand All @@ -20426,6 +20427,32 @@ QUnit.test("getContainerContent - do not show buttons progress in the single pag
assert.deepEqual(getContainerContent("contentBottom"), [], "");
assert.deepEqual(getContainerContent("left"), [], "");
assert.deepEqual(getContainerContent("right"), [], "");

survey.progressBarType = "questions";

assert.deepEqual(getContainerContent("header"), [], "");
assert.deepEqual(getContainerContent("center"), [{
"component": "sv-progress-questions",
"id": "progress-questions"
}], "Buttons progress is shown in the single page mode for questions mode");
assert.deepEqual(getContainerContent("footer"), [], "");
assert.deepEqual(getContainerContent("contentTop"), [], "");
assert.deepEqual(getContainerContent("contentBottom"), [], "");
assert.deepEqual(getContainerContent("left"), [], "");
assert.deepEqual(getContainerContent("right"), [], "");

survey.showProgressBar = "bottom";

assert.deepEqual(getContainerContent("header"), [], "");
assert.deepEqual(getContainerContent("center"), [], "");
assert.deepEqual(getContainerContent("footer"), [{
"component": "sv-progress-questions",
"id": "progress-questions"
}], "Buttons progress is shown in the single page mode for questions mode in bottom");
assert.deepEqual(getContainerContent("contentTop"), [], "");
assert.deepEqual(getContainerContent("contentBottom"), [], "");
assert.deepEqual(getContainerContent("left"), [], "");
assert.deepEqual(getContainerContent("right"), [], "");
});
QUnit.test("Display mode in design time 2", function (assert) {
const survey = new SurveyModel();
Expand Down

0 comments on commit 544617a

Please sign in to comment.