Skip to content

Commit

Permalink
Change the default value for survey focusFirstQuestionAutomatic to fa… (
Browse files Browse the repository at this point in the history
#7156)

* Change the default value for survey focusFirstQuestionAutomatic to false #7155

* Fix functional tests #7155

* Fix functional test #7155

* Fix visual regression tests #7155
  • Loading branch information
andrewtelnov authored Oct 23, 2023
1 parent 2496f5c commit 0ef9225
Show file tree
Hide file tree
Showing 21 changed files with 79 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7471,7 +7471,7 @@ Serializer.addClass("survey", [
default: "left",
choices: ["none", "left", "right", "top", "bottom"],
},
{ name: "focusFirstQuestionAutomatic:boolean", default: true },
{ name: "focusFirstQuestionAutomatic:boolean" },
{ name: "focusOnFirstError:boolean", default: true },
{ name: "completedHtml:html", serializationProperty: "locCompletedHtml" },
{
Expand Down
1 change: 1 addition & 0 deletions testCafe/components/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Selector, ClientFunction } from "testcafe";
const title = "popup";

const json = {
focusFirstQuestionAutomatic: true,
elements: [
{
type: "text",
Expand Down
1 change: 1 addition & 0 deletions testCafe/questions/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ frameworks.forEach((framework) => {
const characterCounter = Selector(".sv-remaining-character-counter");

await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
questions: [
{
name: "comment",
Expand Down
12 changes: 12 additions & 0 deletions testCafe/questions/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ frameworks.forEach((framework) => {

test("Check dropdown key press with searchEnabled", async (t) => {
const jsonWithDropDown = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down Expand Up @@ -724,6 +725,7 @@ frameworks.forEach((framework) => {

test("Select item after switching focus", async (t) => {
const jsonWithDropDown = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down Expand Up @@ -771,6 +773,7 @@ frameworks.forEach((framework) => {

test("Check dropdown key press without searchEnabled", async (t) => {
const jsonWithDropDown = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down Expand Up @@ -855,6 +858,7 @@ frameworks.forEach((framework) => {

test("Check dropdown SPACE press without searchEnabled", async (t) => {
const jsonWithDropDown = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down Expand Up @@ -883,6 +887,7 @@ frameworks.forEach((framework) => {

test("Check dropdown SPACE press with searchEnabled", async (t) => {
const jsonWithDropDown = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand All @@ -909,6 +914,7 @@ frameworks.forEach((framework) => {

test("Check dropdown search", async (t) => {
const jsonWithDropDown = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down Expand Up @@ -1039,6 +1045,7 @@ frameworks.forEach((framework) => {

test("Check dropdown reset filter string", async (t) => {
const jsonWithDropdown = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down Expand Up @@ -1098,6 +1105,7 @@ frameworks.forEach((framework) => {

test("Check dropdown clear value by keyboard", async (t) => {
const jsonWithDropDown = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down Expand Up @@ -1169,6 +1177,7 @@ frameworks.forEach((framework) => {

test("Check popup scroll", async (t) => {
const jsonWithDropDown = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down Expand Up @@ -1365,6 +1374,7 @@ frameworks.forEach((framework) => {
test.page(`${url_test}${theme}/${framework}`)("Check popup height with lazy loading", async (t) => {
await applyTheme(theme);
const json = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down Expand Up @@ -1458,6 +1468,7 @@ frameworks.forEach((framework) => {
test.page(`${url_test}${theme}/${framework}`)("Check popup height and position while searching", async (t) => {
await applyTheme(theme);
const json = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down Expand Up @@ -1617,6 +1628,7 @@ frameworks.forEach((framework) => {

test("Check dropdown popup close with mouse, bug #5860", async (t) => {
const jsonWithDropDown = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down
1 change: 1 addition & 0 deletions testCafe/questions/paneldynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ frameworks.forEach((framework) => {
});

const json3 = {
focusFirstQuestionAutomatic: true,
elements: [
{
type: "matrixdynamic",
Expand Down
6 changes: 6 additions & 0 deletions testCafe/questions/tagbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const title = "tagbox";
const questionOffsetTopConst = 176;

const jsonCloseOnSelectIsTrue = {
focusFirstQuestionAutomatic: true,
showQuestionNumbers: "off",
questions: [
{
Expand Down Expand Up @@ -46,6 +47,7 @@ const jsonCloseOnSelectIsTrue = {
};

const jsonCloseOnSelectIsDefault = {
focusFirstQuestionAutomatic: true,
showQuestionNumbers: "off",
questions: [
{
Expand Down Expand Up @@ -498,6 +500,7 @@ frameworks.forEach((framework) => {
test.page(`${url_test}${theme}/${framework}`)("Check popup height with lazy loading", async (t) => {
await applyTheme(theme);
const json = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "tagbox",
Expand Down Expand Up @@ -594,6 +597,7 @@ frameworks.forEach((framework) => {
test.page(`${url_test}${theme}/${framework}`)("Check popup height and position while searching", async (t) => {
await applyTheme(theme);
const json = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "tagbox",
Expand Down Expand Up @@ -725,6 +729,7 @@ frameworks.forEach((framework) => {
test.page(`${url_test}${theme}/${framework}`)("Check popup height with lazy loading, if closeOnSelect is false", async (t) => {
await applyTheme(theme);
const json = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "tagbox",
Expand Down Expand Up @@ -822,6 +827,7 @@ frameworks.forEach((framework) => {
test.page(`${url_test}${theme}/${framework}`)("Check popup height and position while searching, if closeOnSelect is false", async (t) => {
await applyTheme(theme);
const json = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "tagbox",
Expand Down
2 changes: 2 additions & 0 deletions testCafe/questions/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ frameworks.forEach((framework) => {
const characterCounter = Selector(".sv-remaining-character-counter");

await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
questions: [
{
name: "name",
Expand Down Expand Up @@ -221,6 +222,7 @@ frameworks.forEach((framework) => {
});
test("Allow Space As Answer", async (t) => {
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
questions: [
{
name: "name",
Expand Down
3 changes: 3 additions & 0 deletions testCafe/survey/autoNextPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const assert = require("assert");
const title = "autoNextPage";

const json = {
focusFirstQuestionAutomatic: true,
title: "American History",
showProgressBar: "bottom",
goNextPageAutomatic: true,
Expand Down Expand Up @@ -60,6 +61,7 @@ const json = {
"<p>Your anwers are:</p><p>When was the Civil War?: <b>{civilwar}</b>. The correct is: <b>1850-1900</b></p><p>Who said 'Give me liberty or give me death?': <b>{libertyordeath}</b>. The correct is: <b>Patrick Henry</b></p><p>What is the Magna Carta?: <b>{magnacarta}</b>. The correct is: <b>The foundation of the British parliamentary system</b></p>"
};
const json2 = {
focusFirstQuestionAutomatic: true,
goNextPageAutomatic: true,
pages: [
{
Expand All @@ -75,6 +77,7 @@ const json2 = {
]
};
const json3 = {
focusFirstQuestionAutomatic: true,
goNextPageAutomatic: true,
pages: [
{
Expand Down
1 change: 1 addition & 0 deletions testCafe/survey/focusFirstQuestionAutomatic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Selector, ClientFunction } from "testcafe";
const title = "focusFirstQuestionAutomatic";

const json = {
focusFirstQuestionAutomatic: true,
pages: [
{
elements: [
Expand Down
2 changes: 2 additions & 0 deletions testCafe/survey/focusQuestionEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Selector, ClientFunction } from "testcafe";
const title = "focusFirstQuestionAutomatic";

const json = {
focusFirstQuestionAutomatic: true,
pages: [
{
elements: [
Expand Down Expand Up @@ -189,6 +190,7 @@ frameworks.forEach(async framework => {
return window["survey_focusedName"];
});
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
pages: [
{
elements: [
Expand Down
2 changes: 2 additions & 0 deletions testCafe/validation/focusErroredInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { frameworks, url, initSurvey, getSurveyResult } from "../helper";
import { Selector, ClientFunction, fixture, test } from "testcafe";
const title = "focus input with Error";
const json1 = {
focusFirstQuestionAutomatic: true,
"pages": [
{
"name": "page1",
Expand Down Expand Up @@ -35,6 +36,7 @@ const json1 = {
"checkErrorsMode": "onComplete"
};
const json2 = {
focusFirstQuestionAutomatic: true,
"pages": [
{
"name": "page1",
Expand Down
2 changes: 2 additions & 0 deletions visualRegressionTests/tests/defaultV2/advancedHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ frameworks.forEach(framework => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1200, 1000);
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
title: "Survey Title",
description: "Survey description",
logo: "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg",
Expand Down Expand Up @@ -50,6 +51,7 @@ frameworks.forEach(framework => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1200, 1000);
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
title: "Survey Title",
description: "Survey description",
logo: "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg",
Expand Down
1 change: 1 addition & 0 deletions visualRegressionTests/tests/defaultV2/boolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ frameworks.forEach(framework => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1920, 1080);
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "boolean",
Expand Down
4 changes: 4 additions & 0 deletions visualRegressionTests/tests/defaultV2/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ frameworks.forEach(framework => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1920, 1080);
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
showQuestionNumbers: "off",
questions: [
{
Expand Down Expand Up @@ -189,6 +190,7 @@ frameworks.forEach(framework => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1280, 1100);
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
showQuestionNumbers: "off",
questions: [
{
Expand Down Expand Up @@ -432,6 +434,7 @@ frameworks.forEach(framework => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1280, 1100);
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
showQuestionNumbers: "off",
questions: [
{
Expand Down Expand Up @@ -562,6 +565,7 @@ frameworks.forEach(framework => {
await registerCustomItemComponent(framework);

const jsonWithDropDown = {
focusFirstQuestionAutomatic: true,
questions: [
{
type: "dropdown",
Expand Down
3 changes: 3 additions & 0 deletions visualRegressionTests/tests/defaultV2/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ frameworks.forEach(framework => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1200, 1200);
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
"pages": [
{
"name": "page1",
Expand Down Expand Up @@ -209,6 +210,7 @@ frameworks.forEach(framework => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1200, 1200);
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
"pages": [
{
"name": "page1",
Expand Down Expand Up @@ -1019,6 +1021,7 @@ frameworks.forEach(framework => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1920, 1080);
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
"elements": [
{
"type": "matrixdropdown",
Expand Down
1 change: 1 addition & 0 deletions visualRegressionTests/tests/defaultV2/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ frameworks.forEach(framework => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1920, 1080);
await initSurvey(framework, {
focusFirstQuestionAutomatic: true,
width: "900px",
questions: [
{
Expand Down
Loading

0 comments on commit 0ef9225

Please sign in to comment.