Skip to content

Commit

Permalink
Navigation button visibility for start page is only overridden if nex…
Browse files Browse the repository at this point in the history
…t page has visibility set as well fix #9248 (#9252)
  • Loading branch information
andrewtelnov authored Jan 3, 2025
1 parent bcbf9a9 commit 52b1df8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/survey-core/src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3776,7 +3776,7 @@ export class SurveyModel extends SurveyElementCore
}
public get isNavigationButtonsShowing(): string {
if (this.isDesignMode) return "none";
var page = this.currentPage;
var page = this.activePage;
if (!page) return "none";
if (page.navigationButtonsVisibility === "show") {
return this.showNavigationButtons === "none" ? "bottom" : this.showNavigationButtons;
Expand Down
25 changes: 24 additions & 1 deletion packages/survey-core/tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18594,6 +18594,29 @@ QUnit.test("getContainerContent - navigation with page.navigationButtonsVisibili
assert.deepEqual(getContainerContent("left"), [], "default left");
assert.deepEqual(getContainerContent("right"), [], "default right");
});
QUnit.test("survey.showNavigationButtons = 'none', page.navigationButtonsVisibility = 'show' & firstPageIsStarted is true, Bug#9248", function (assert) {
const survey = new SurveyModel({
showNavigationButtons: "none",
firstPageIsStarted: true,
pages: [
{
"navigationButtonsVisibility": "show",
"elements": [{ type: "text", name: "q1" }]
},
{
"elements": [{ type: "text", name: "q2" }]
},
{
"elements": [{ type: "text", name: "q2" }]
}
]
});
assert.equal(survey.state, "starting", "The first page is started");
assert.equal(survey.isNavigationButtonsShowing, "bottom", "The first page is started");
survey.start();
assert.equal(survey.state, "running", "The start button is cliced");
assert.equal(survey.isNavigationButtonsShowing, "none", "Hide navigation buttons");
});

QUnit.test("getContainerContent - header elements order", function (assert) {
function getContainerContent(container: LayoutElementContainer) {
Expand Down Expand Up @@ -21111,4 +21134,4 @@ QUnit.test("#9110 check focus question inside paneldynamic works correctly", fun
assert.equal(log, "->text_question_id->focused text question");
SurveyElement.ScrollElementToViewCore = oldScrollElementToViewCore;
SurveyElement.ScrollElementToTop = oldScrollElementToTop;
});
});

0 comments on commit 52b1df8

Please sign in to comment.