Skip to content

Commit

Permalink
Fix: #252, goNextPageAutomatic and clearInvisibleValues properties se…
Browse files Browse the repository at this point in the history
…tting to true cause stackoverflow.
  • Loading branch information
andrewtelnov committed Feb 27, 2017
1 parent 7ed0def commit a9d0df8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ export class SurveyModel extends Base implements ISurvey, ISurveyTriggerOwner {
private tryGoNextPageAutomatic(name: string) {
if (!this.goNextPageAutomatic || !this.currentPage) return;
var question = this.getQuestionByName(name);
if (question && !question.supportGoNextPageAutomatic()) return;
if (question && (!question.visible || !question.supportGoNextPageAutomatic())) return;
var questions = this.getCurrentPageQuestions();
for (var i = 0; i < questions.length; i++) {
if (questions[i].hasInput && !this.getValue(questions[i].name)) return;
Expand Down
15 changes: 15 additions & 0 deletions tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,21 @@ QUnit.test("goNextPageAutomatic bug #200: https://github.com/surveyjs/surveyjs/i
assert.equal(survey.currentPage.name, survey.pages[1].name, "go to the next page");
});

QUnit.test("goNextPageAutomatic and clearInvisibleValues bug #252: https://github.com/surveyjs/surveyjs/issues/252", function (assert) {
var survey = new SurveyModel();
var page = survey.addNewPage("page1");
var q1 = <QuestionDropdownModel>page.addNewQuestion("dropdown", "q1");
q1.choices = [1, 2, 3];
var q2 = <QuestionDropdownModel>page.addNewQuestion("dropdown", "q2");
q2.visible = false;
q2.value = 1;
survey.goNextPageAutomatic = true;
survey.clearInvisibleValues = true;
(<Question>survey.getQuestionByName("q1")).value = 1;
assert.equal(survey.state, "completed");
});


QUnit.test("isNavigationButtonsShowing", function (assert) {
var survey = twoPageSimplestSurvey();
assert.equal(survey.isNavigationButtonsShowing, true, "by default buttons are shown");
Expand Down

0 comments on commit a9d0df8

Please sign in to comment.