Skip to content

Commit

Permalink
Add unit test in start page button visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Oct 16, 2023
1 parent 21ccb18 commit 6e53d4b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down

0 comments on commit 6e53d4b

Please sign in to comment.