Skip to content

Commit

Permalink
Rename settings, and fix functional tests #7153
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Oct 16, 2023
1 parent fab6a3f commit 2e6cfb4
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ export var settings = {
notifications: {
lifetime: 2000
},
nextPageAutomaticDelay: 300,
autoAdvanceDelay: 300,
/**
* Specifies the direction in which to lay out Checkbox and Radiogroup items. This setting affects the resulting UI when items are arranged in [more than one column](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model#colCount).
*
Expand Down
2 changes: 1 addition & 1 deletion src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6344,7 +6344,7 @@ export class SurveyModel extends SurveyElementCore
}
}
};
surveyTimerFunctions.safeTimeOut(goNextPage, settings.nextPageAutomaticDelay);
surveyTimerFunctions.safeTimeOut(goNextPage, settings.autoAdvanceDelay);
}
/**
* Returns a comment value from a question with a specified `name`.
Expand Down
17 changes: 12 additions & 5 deletions testCafe/survey/autoNextPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,14 @@ frameworks.forEach(framework => {
);
let surveyResult;
assert.notEqual(await getProgressTextPosition(1), -1);
await t.click("input[type=radio]");
await t.click("input[type=radio]")
.wait(500);
assert.notEqual(await getProgressTextPosition(2), -1);
await t.click("input[type=radio]");
await t.click("input[type=radio]")
.wait(500);
assert.notEqual(await getProgressTextPosition(3), -1);
await t.click("input[type=radio]");
await t.click("input[type=radio]")
.wait(500);
surveyResult = await getSurveyResult();
await t.expect(surveyResult).eql({
civilwar: "1750-1800",
Expand Down Expand Up @@ -154,8 +157,11 @@ frameworks.forEach(framework => {

await t
.click("input[name=\"sq_100_A\"][value=\"1\"]")
.wait(500)
.click("input[name=\"sq_100_B\"][value=\"2\"]")
.click("input[name=\"sq_100_C\"][value=\"3\"]");
.wait(500)
.click("input[name=\"sq_100_C\"][value=\"3\"]")
.wait(500);

surveyResult = await getSurveyResult();
assert.deepEqual(surveyResult.q1, { A: 1, B: 2, C: 3 });
Expand Down Expand Up @@ -187,7 +193,8 @@ frameworks.forEach(framework => {
let surveyResult;
const label3 = Selector("label").withText("3");
await t
.click(label3);
.click(label3)
.wait(500);

surveyResult = await getSurveyResult();
assert.equal(surveyResult.q1, 3);
Expand Down
2 changes: 1 addition & 1 deletion tests/ko/survey_kotests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { settings } from "../../src/settings";

export default QUnit.module("koTests");

settings.nextPageAutomaticDelay = 0;
settings.autoAdvanceDelay = 0;

QUnit.test("koOtherVisible for one choice items", function (assert) {
var survey = new Survey();
Expand Down
2 changes: 1 addition & 1 deletion tests/surveyShowPreviewTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { settings } from "../src/settings";

export default QUnit.module("SurveyShowPreviewTests");

settings.nextPageAutomaticDelay = 0;
settings.autoAdvanceDelay = 0;

QUnit.test("Complete and Preview button visibility", function(assert) {
var survey = new SurveyModel({ elements: [{ type: "text", name: "q1" }] });
Expand Down
6 changes: 3 additions & 3 deletions tests/surveyquestiontests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { surveyTimerFunctions } from "../src/surveytimer";

export default QUnit.module("Survey_Questions");

settings.nextPageAutomaticDelay = 0;
settings.autoAdvanceDelay = 0;

class QuestionMatrixRandomModel extends QuestionMatrixModel {
constructor(name: string) {
Expand Down Expand Up @@ -831,7 +831,7 @@ QUnit.test("Multiple Text Question: support goNextPageAutomatic", function (
);
});
QUnit.test("Use timer to go next page", function (assert) {
settings.nextPageAutomaticDelay = 250;
settings.autoAdvanceDelay = 250;
const json = {
pages: [
{
Expand Down Expand Up @@ -870,7 +870,7 @@ QUnit.test("Use timer to go next page", function (assert) {
assert.equal(survey.currentPageNo, 1, "Go to the second page");
assert.equal(checkDelay, 250, "setTimeout function is called");
surveyTimerFunctions.safeTimeOut = prevFunc;
settings.nextPageAutomaticDelay = 0;
settings.autoAdvanceDelay = 0;
});
QUnit.test("Radiogroup Question: support goNextPageAutomatic + hasOther", function (assert) {
var json = {
Expand Down
2 changes: 1 addition & 1 deletion tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import { StylesManager } from "../src/stylesmanager";

export default QUnit.module("Survey");

settings.nextPageAutomaticDelay = 0;
settings.autoAdvanceDelay = 0;

QUnit.test("set data property", function (assert) {
var survey = new SurveyModel();
Expand Down

0 comments on commit 2e6cfb4

Please sign in to comment.