Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make allowCompleteSurveyAutomatic prop serializable #7914

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,7 @@ export class SurveyModel extends SurveyElementCore
* @see [`settings.autoAdvanceDelay`](https://surveyjs.io/form-library/documentation/api-reference/settings#autoAdvanceDelay)
*/
public get allowCompleteSurveyAutomatic(): boolean {
return this.getPropertyValue("allowCompleteSurveyAutomatic", true);
return this.getPropertyValue("allowCompleteSurveyAutomatic");
}
public set allowCompleteSurveyAutomatic(val: boolean) {
this.setPropertyValue("allowCompleteSurveyAutomatic", val);
Expand Down Expand Up @@ -7847,6 +7847,10 @@ Serializer.addClass("survey", [
obj.setPropertyValue("goNextPageAutomatic", value);
}
},
{
name: "allowCompleteSurveyAutomatic:boolean", default: true,
visibleIf: (obj: any): boolean => obj.goNextPageAutomatic === true
},
{
name: "clearInvisibleValues",
default: "onComplete",
Expand Down
20 changes: 20 additions & 0 deletions tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4179,6 +4179,26 @@ QUnit.test(
assert.equal(survey.state, "completed");
}
);
QUnit.test("goNextPageAutomatic and allowCompleteSurveyAutomatic=false", function (assert) {
const emptySurvey = new SurveyModel();
assert.equal(emptySurvey.allowCompleteSurveyAutomatic, true, "allowCompleteSurveyAutomatic value # 1");
const survey = new SurveyModel({
pages: [
{ elements: [{ type: "dropdown", name: "q1", choices: [1, 2, 3] }] },
{ elements: [{ type: "dropdown", name: "q2", choices: [1, 2, 3] }] }
],
goNextPageAutomatic: true,
allowCompleteSurveyAutomatic: false
});
assert.equal(survey.allowCompleteSurveyAutomatic, false, "allowCompleteSurveyAutomatic value # 2");
const q1 = survey.getQuestionByName("q1");
const q2 = survey.getQuestionByName("q2");
assert.equal(survey.currentPageNo, 0, "curPage #1");
q1.value = 1;
assert.equal(survey.currentPageNo, 1, "curPage #2");
q2.value = 1;
assert.equal(survey.currentPageNo, 1, "curPage #2");
});

QUnit.test("goNextPageAutomatic and checkbox wiht valueName bug #70", function (
assert
Expand Down
Loading