From 52b1df8fb1daf3209e3f938dfeb38d6ac4410e3c Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 3 Jan 2025 07:43:57 +0000 Subject: [PATCH] Navigation button visibility for start page is only overridden if next page has visibility set as well fix #9248 (#9252) --- packages/survey-core/src/survey.ts | 2 +- packages/survey-core/tests/surveytests.ts | 25 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/packages/survey-core/src/survey.ts b/packages/survey-core/src/survey.ts index d284dc6e1c..f7e01380de 100644 --- a/packages/survey-core/src/survey.ts +++ b/packages/survey-core/src/survey.ts @@ -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; diff --git a/packages/survey-core/tests/surveytests.ts b/packages/survey-core/tests/surveytests.ts index 0da79bdba4..2d28e7cab0 100644 --- a/packages/survey-core/tests/surveytests.ts +++ b/packages/survey-core/tests/surveytests.ts @@ -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) { @@ -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; -}); \ No newline at end of file +});