From 6e53d4b298435cd66a48751a6266e0b7de5314aa Mon Sep 17 00:00:00 2001 From: Andrew Telnov Date: Mon, 16 Oct 2023 12:58:13 +0300 Subject: [PATCH] Add unit test in start page button visibility --- tests/surveytests.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/surveytests.ts b/tests/surveytests.ts index 1787209a36..3ae358715c 100644 --- a/tests/surveytests.ts +++ b/tests/surveytests.ts @@ -15334,6 +15334,44 @@ QUnit.test("firstPageIsStarted = true and invisible questions and clear", functi survey.clear(true, true); assert.equal(q2.isVisible, false, "invisible again"); }); +QUnit.test("firstPageIsStarted = true and clear&state='starting'", function (assert) { + const survey = new SurveyModel({ + firstPageIsStarted: true, + goNextPageAutomatic: true, + showProgressBar: "bottom", + showTimerPanel: "top", + maxTimeToFinishPage: 10, + maxTimeToFinish: 25, + pages: [ + { + elements: [ + { type: "text", name: "q1" } + ] + }, + { + elements: [ + { type: "text", name: "q2" } + ] + } + ] + }); + const startButton = survey.navigationBar.getActionById("sv-nav-start"); + assert.equal(survey.state, "starting", "starting state #1"); + assert.equal(survey.getPropertyValue("isStartedState"), true, "isStartedState #1"); + assert.equal(startButton.isVisible, true, "startButton is visible, #1"); + assert.equal(survey.showNavigationButtons, "bottom", "Show navigation on bottom"); + survey.start(); + assert.equal(survey.state, "running", "run survey"); + assert.equal(survey.getPropertyValue("isStartedState"), false, "isStartedState #2"); + survey.doComplete(); + assert.equal(survey.state, "completed", "survey is completed"); + assert.equal(survey.getPropertyValue("isStartedState"), false, "isStartedState #3"); + survey.clear(); + assert.equal(survey.state, "starting", "starting state #2"); + assert.equal(survey.getPropertyValue("isStartedState"), true, "isStartedState #4"); + assert.equal(startButton.isVisible, true, "startButton is visible, #2"); + assert.equal(survey.isNavigationButtonsShowing, "bottom", "Show navigation buttons on start"); +}); QUnit.test("skeleton component name", function (assert) { var survey = new SurveyModel({ pages: [