+
+
+
{{ model.headerText }}
+
@@ -14,18 +17,20 @@
-
+
{{ page.renderedNavigationTitle }}
-
@@ -35,63 +40,63 @@
+
+
{{ model.footerText }}
+
diff --git a/tests/ko/survey_kotests.ts b/tests/ko/survey_kotests.ts
index be97b57a0f..fad8c71242 100644
--- a/tests/ko/survey_kotests.ts
+++ b/tests/ko/survey_kotests.ts
@@ -25,6 +25,7 @@ import * as ko from "knockout";
import { ItemValue } from "../../src/itemvalue";
import { StylesManager } from "../../src/stylesmanager";
import { settings } from "../../src/settings";
+import { ProgressButtons } from "../../src/progress-buttons";
export default QUnit.module("koTests");
@@ -1899,23 +1900,26 @@ QUnit.test("ProgressButtonsViewModel component scroll button", function (
StylesManager.applyTheme("default");
let survey: Survey = new Survey(json);
let progress: ProgressButtonsViewModel = new ProgressButtonsViewModel(
- survey,
+ new ProgressButtons(survey as any),
{
querySelector: function () {
return undefined;
},
- }
+ querySelectorAll: function () {
+ return [] as any;
+ },
+ } as any
);
progress.dispose();
assert.equal(
- progress.getScrollButtonCss(true)(),
+ progress.getScrollButtonCss(true),
survey.css.progressButtonsImageButtonLeft +
" " +
survey.css.progressButtonsImageButtonHidden,
"1) Scroll button left style is hidden"
);
assert.equal(
- progress.getScrollButtonCss(false)(),
+ progress.getScrollButtonCss(false),
survey.css.progressButtonsImageButtonRight +
" " +
survey.css.progressButtonsImageButtonHidden,
@@ -1924,12 +1928,12 @@ QUnit.test("ProgressButtonsViewModel component scroll button", function (
progress["hasScroller"](true);
assert.equal(
- progress.getScrollButtonCss(true)(),
+ progress.getScrollButtonCss(true),
survey.css.progressButtonsImageButtonLeft,
"2) Scroll button left style is visible"
);
assert.equal(
- progress.getScrollButtonCss(false)(),
+ progress.getScrollButtonCss(false),
survey.css.progressButtonsImageButtonRight,
"2) Scroll button right style is visible"
);
diff --git a/tests/surveyProgressButtonsTest.ts b/tests/surveyProgressButtonsTest.ts
index a8fc6a745a..803521344c 100644
--- a/tests/surveyProgressButtonsTest.ts
+++ b/tests/surveyProgressButtonsTest.ts
@@ -1,9 +1,9 @@
import { SurveyModel } from "../src/survey";
-import { SurveyProgressButtonsModel } from "../src/surveyProgressButtons";
+import { ProgressButtons } from "../src/progress-buttons";
-export default QUnit.module("SurveyProgressButtons");
+export default QUnit.module("ProgressButtons");
-QUnit.test("SurveyProgressButtonsModel list elements", function(assert) {
+QUnit.test("ProgressButtons list elements", function (assert) {
const json: any = {
"pages": [
{
@@ -36,7 +36,7 @@ QUnit.test("SurveyProgressButtonsModel list elements", function(assert) {
]
};
const survey: SurveyModel = new SurveyModel(json);
- const progress: SurveyProgressButtonsModel = new SurveyProgressButtonsModel(survey);
+ const progress: ProgressButtons = new ProgressButtons(survey);
assert.equal(progress.getListElementCss(0),
survey.css.progressButtonsListElementCurrent,
"1) Page 1 style is current");
@@ -61,7 +61,7 @@ QUnit.test("SurveyProgressButtonsModel list elements", function(assert) {
assert.equal(survey.currentPageNo, 0, "currentPageNo #2");
assert.equal(progress.getListElementCss(0),
survey.css.progressButtonsListElementPassed + " " +
- survey.css.progressButtonsListElementCurrent,
+ survey.css.progressButtonsListElementCurrent,
"3) Page 1 style is passed and current");
assert.equal(progress.getListElementCss(1),
survey.css.progressButtonsListElementPassed,
@@ -69,7 +69,7 @@ QUnit.test("SurveyProgressButtonsModel list elements", function(assert) {
assert.equal(progress.getListElementCss(2),
"", "3) Page 3 style is empty");
});
-QUnit.test("SurveyProgressButtonsModel list elements non clickable", function(assert) {
+QUnit.test("ProgressButtons list elements non clickable", function (assert) {
let json: any = {
"pages": [
{
@@ -103,7 +103,7 @@ QUnit.test("SurveyProgressButtonsModel list elements non clickable", function(as
};
let survey: SurveyModel = new SurveyModel(json);
survey.onServerValidateQuestions.add((_: any, options: any) => options.complete());
- let progress: SurveyProgressButtonsModel = new SurveyProgressButtonsModel(survey);
+ let progress: ProgressButtons = new ProgressButtons(survey);
assert.equal(progress.getListElementCss(0),
survey.css.progressButtonsListElementCurrent,
"1) Page 1 style is current");
diff --git a/tests/surveytests.ts b/tests/surveytests.ts
index f8ec6815fa..c065ab38d0 100644
--- a/tests/surveytests.ts
+++ b/tests/surveytests.ts
@@ -16964,7 +16964,7 @@ QUnit.test("getContainerContent - navigation", function (assert) {
assert.deepEqual(getContainerContent("contentTop"), [], "default contentTop");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "default contentBottom");
assert.deepEqual(getContainerContent("left"), [], "default left");
assert.deepEqual(getContainerContent("right"), [], "default right");
@@ -16974,7 +16974,7 @@ QUnit.test("getContainerContent - navigation", function (assert) {
assert.deepEqual(getContainerContent("footer"), [], "nav top footer");
assert.deepEqual(getContainerContent("contentTop"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "nav top contentTop");
assert.deepEqual(getContainerContent("contentBottom"), [], "nav top contentBottom");
assert.deepEqual(getContainerContent("left"), [], "nav top left");
@@ -16985,11 +16985,11 @@ QUnit.test("getContainerContent - navigation", function (assert) {
assert.deepEqual(getContainerContent("footer"), [], "nav both footer");
assert.deepEqual(getContainerContent("contentTop"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "nav both contentTop");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "nav both contentBottom");
assert.deepEqual(getContainerContent("left"), [], "nav both left");
assert.deepEqual(getContainerContent("right"), [], "nav both right");
@@ -16999,11 +16999,11 @@ QUnit.test("getContainerContent - navigation", function (assert) {
assert.deepEqual(getContainerContent("footer"), [], "nav left footer");
assert.deepEqual(getContainerContent("contentTop"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "nav left contentTop");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "nav left contentBottom");
assert.deepEqual(getContainerContent("left"), [{
"component": "sv-navigation-toc",
@@ -17016,11 +17016,11 @@ QUnit.test("getContainerContent - navigation", function (assert) {
assert.deepEqual(getContainerContent("footer"), [], "nav right footer");
assert.deepEqual(getContainerContent("contentTop"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "nav right contentTop");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "nav right contentBottom");
assert.deepEqual(getContainerContent("left"), [], "nav right left");
assert.deepEqual(getContainerContent("right"), [{
@@ -17039,7 +17039,166 @@ QUnit.test("getContainerContent - navigation", function (assert) {
assert.deepEqual(getContainerContent("right"), [], "nav none right");
});
+QUnit.test("getContainerContent - progress (legacyProgressBarView)", function (assert) {
+ const json = {
+ showNavigationButtons: "none",
+ pages: [
+ {
+ "elements": [
+ {
+ required: true,
+ "type": "rating",
+ "name": "satisfaction",
+ },
+ {
+ required: true,
+ "type": "rating",
+ "name": "recommend friends",
+ }
+ ]
+ },
+ {
+ "elements": [
+ {
+ "type": "radiogroup",
+ "name": "price to competitors",
+ },
+ {
+ "type": "radiogroup",
+ "name": "price",
+ },
+ ]
+ },
+ ]
+ };
+
+ try {
+ settings.legacyProgressBarView = true;
+
+ let survey = new SurveyModel(json);
+ const getContainerContent = getContainerContentFunction(survey);
+
+ assert.equal(survey.showNavigationButtons, "none");
+ assert.equal(survey.progressBarType, "pages");
+ assert.equal(survey.showProgressBar, "off");
+
+ assert.deepEqual(getContainerContent("header"), [], "default header");
+ assert.deepEqual(getContainerContent("footer"), [], "default footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "default contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "default contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "default left");
+ assert.deepEqual(getContainerContent("right"), [], "default right");
+
+ survey.showProgressBar = "top";
+ assert.deepEqual(getContainerContent("header"), [], "progress top header");
+ assert.deepEqual(getContainerContent("center"), [{
+ "component": "sv-progress-pages",
+ "id": "progress-pages"
+ }], "progress top center");
+ assert.deepEqual(getContainerContent("footer"), [], "progress top footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "progress top contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "progress top contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "progress top left");
+ assert.deepEqual(getContainerContent("right"), [], "progress top right");
+
+ survey.showProgressBar = "bottom";
+ assert.deepEqual(getContainerContent("header"), [], "progress bottom header");
+ assert.deepEqual(getContainerContent("footer"), [{
+ "component": "sv-progress-pages",
+ "id": "progress-pages"
+ }], "progress bottom footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "progress bottom contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "progress bottom contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "progress bottom left");
+ assert.deepEqual(getContainerContent("right"), [], "progress bottom right");
+
+ survey.showProgressBar = "both";
+ assert.deepEqual(getContainerContent("header"), [], "progress both header");
+ assert.deepEqual(getContainerContent("center"), [{
+ "component": "sv-progress-pages",
+ "id": "progress-pages"
+ }], "progress both center");
+ assert.deepEqual(getContainerContent("footer"), [{
+ "component": "sv-progress-pages",
+ "id": "progress-pages"
+ }], "progress both footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "progress both contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "progress both contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "progress both left");
+ assert.deepEqual(getContainerContent("right"), [], "progress both right");
+
+ survey.progressBarType = "questions";
+ assert.deepEqual(getContainerContent("header"), [], "progress questions both header");
+ assert.deepEqual(getContainerContent("center"), [{
+ "component": "sv-progress-questions",
+ "id": "progress-questions"
+ }], "progress questions both header");
+ assert.deepEqual(getContainerContent("footer"), [{
+ "component": "sv-progress-questions",
+ "id": "progress-questions"
+ }], "progress questions both footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "progress questions both contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "progress questions both contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "progress questions both left");
+ assert.deepEqual(getContainerContent("right"), [], "progress questions both right");
+
+ survey.showTOC = true;
+ assert.deepEqual(getContainerContent("header"), [], "progress toc both header");
+ assert.deepEqual(getContainerContent("center"), [{
+ "component": "sv-progress-questions",
+ "id": "progress-questions"
+ }], "progress toc both center");
+ assert.deepEqual(getContainerContent("footer"), [{
+ "component": "sv-progress-questions",
+ "id": "progress-questions"
+ }], "progress toc both footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "progress toc both contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "progress toc both contentBottom");
+ assert.deepEqual(getContainerContent("left"), [{
+ "component": "sv-navigation-toc",
+ "id": "toc-navigation"
+ }], "progress toc both left");
+ assert.deepEqual(getContainerContent("right"), [], "progress toc both right");
+
+ survey.showProgressBar = "off";
+ survey.tocLocation = "left";
+ assert.deepEqual(getContainerContent("header"), [], "progress toc left header");
+ assert.deepEqual(getContainerContent("footer"), [], "progress toc left footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "progress toc left contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "progress toc left contentBottom");
+ assert.deepEqual(getContainerContent("left"), [{
+ "component": "sv-navigation-toc",
+ "id": "toc-navigation"
+ }], "progress toc left left");
+ assert.deepEqual(getContainerContent("right"), [], "progress toc left right");
+
+ survey.tocLocation = "right";
+ assert.deepEqual(getContainerContent("header"), [], "progress toc right header");
+ assert.deepEqual(getContainerContent("footer"), [], "progress toc right footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "progress toc right contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "progress toc right contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "progress toc right left");
+ assert.deepEqual(getContainerContent("right"), [{
+ "component": "sv-navigation-toc",
+ "id": "toc-navigation"
+ }], "progress toc right right");
+
+ survey.showTOC = false;
+ assert.deepEqual(getContainerContent("header"), [], "default header");
+ assert.deepEqual(getContainerContent("footer"), [], "default footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "default contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "default contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "default left");
+ assert.deepEqual(getContainerContent("right"), [], "default right");
+
+ }
+ finally {
+ settings.legacyProgressBarView = false;
+ }
+});
+
QUnit.test("getContainerContent - progress", function (assert) {
+ surveyCss.currentType = "defaultV2";
const json = {
showNavigationButtons: "none",
pages: [
@@ -17073,11 +17232,7 @@ QUnit.test("getContainerContent - progress", function (assert) {
};
let survey = new SurveyModel(json);
- function getContainerContent(container: LayoutElementContainer) {
- let result = survey.getContainerContent(container);
- result.forEach(item => delete item["data"]);
- return result;
- }
+ const getContainerContent = getContainerContentFunction(survey);
assert.equal(survey.showNavigationButtons, "none");
assert.equal(survey.progressBarType, "pages");
@@ -17093,8 +17248,8 @@ QUnit.test("getContainerContent - progress", function (assert) {
survey.showProgressBar = "top";
assert.deepEqual(getContainerContent("header"), [], "progress top header");
assert.deepEqual(getContainerContent("center"), [{
- "component": "sv-progress-pages",
- "id": "progress-pages"
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons"
}], "progress top center");
assert.deepEqual(getContainerContent("footer"), [], "progress top footer");
assert.deepEqual(getContainerContent("contentTop"), [], "progress top contentTop");
@@ -17105,8 +17260,8 @@ QUnit.test("getContainerContent - progress", function (assert) {
survey.showProgressBar = "bottom";
assert.deepEqual(getContainerContent("header"), [], "progress bottom header");
assert.deepEqual(getContainerContent("footer"), [{
- "component": "sv-progress-pages",
- "id": "progress-pages"
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons"
}], "progress bottom footer");
assert.deepEqual(getContainerContent("contentTop"), [], "progress bottom contentTop");
assert.deepEqual(getContainerContent("contentBottom"), [], "progress bottom contentBottom");
@@ -17116,12 +17271,12 @@ QUnit.test("getContainerContent - progress", function (assert) {
survey.showProgressBar = "both";
assert.deepEqual(getContainerContent("header"), [], "progress both header");
assert.deepEqual(getContainerContent("center"), [{
- "component": "sv-progress-pages",
- "id": "progress-pages"
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons"
}], "progress both center");
assert.deepEqual(getContainerContent("footer"), [{
- "component": "sv-progress-pages",
- "id": "progress-pages"
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons"
}], "progress both footer");
assert.deepEqual(getContainerContent("contentTop"), [], "progress both contentTop");
assert.deepEqual(getContainerContent("contentBottom"), [], "progress both contentBottom");
@@ -17229,7 +17384,7 @@ QUnit.test("getContainerContent - do not show TOC on preview", function (assert)
assert.deepEqual(getContainerContent("contentTop"), [], "");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "");
assert.deepEqual(getContainerContent("left"), [{
"component": "sv-navigation-toc",
@@ -17245,7 +17400,7 @@ QUnit.test("getContainerContent - do not show TOC on preview", function (assert)
assert.deepEqual(getContainerContent("contentTop"), [], "");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "");
assert.deepEqual(getContainerContent("left"), [], "do not show toc left");
assert.deepEqual(getContainerContent("right"), [], "");
@@ -17295,7 +17450,7 @@ QUnit.test("getContainerContent - do not show TOC on start page", function (asse
assert.deepEqual(getContainerContent("contentTop"), [], "");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "");
assert.deepEqual(getContainerContent("left"), [], "empty on the start page");
@@ -17305,7 +17460,7 @@ QUnit.test("getContainerContent - do not show TOC on start page", function (asse
assert.deepEqual(getContainerContent("contentTop"), [], "");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "");
assert.deepEqual(getContainerContent("left"), [{
"component": "sv-navigation-toc",
@@ -17347,11 +17502,7 @@ QUnit.test("getContainerContent - do not show buttons progress on completed page
};
let survey = new SurveyModel(json);
- function getContainerContent(container: LayoutElementContainer) {
- let result = survey.getContainerContent(container);
- result.forEach(item => delete item["data"]);
- return result;
- }
+ const getContainerContent = getContainerContentFunction(survey);
assert.deepEqual(getContainerContent("header"), [], "");
assert.deepEqual(getContainerContent("footer"), [], "");
@@ -17362,7 +17513,7 @@ QUnit.test("getContainerContent - do not show buttons progress on completed page
assert.deepEqual(getContainerContent("contentTop"), [], "");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "");
assert.deepEqual(getContainerContent("left"), [], "");
assert.deepEqual(getContainerContent("right"), [], "");
@@ -17374,7 +17525,7 @@ QUnit.test("getContainerContent - do not show buttons progress on completed page
assert.deepEqual(getContainerContent("contentTop"), [], "");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "");
assert.deepEqual(getContainerContent("left"), [], "");
assert.deepEqual(getContainerContent("right"), [], "");
@@ -17414,7 +17565,7 @@ QUnit.test("getContainerContent - do not advanced header on completed page", fun
assert.deepEqual(getContainerContent("contentTop"), [], "");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "");
assert.deepEqual(getContainerContent("left"), [], "");
assert.deepEqual(getContainerContent("right"), [], "");
@@ -17426,7 +17577,7 @@ QUnit.test("getContainerContent - do not advanced header on completed page", fun
assert.deepEqual(getContainerContent("contentTop"), [], "");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "");
assert.deepEqual(getContainerContent("left"), [], "");
assert.deepEqual(getContainerContent("right"), [], "");
@@ -17713,7 +17864,7 @@ QUnit.test("getContainerContent - navigation with page.navigationButtonsVisibili
assert.deepEqual(getContainerContent("contentTop"), [], "default contentTop");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "default contentBottom");
assert.deepEqual(getContainerContent("left"), [], "default left");
assert.deepEqual(getContainerContent("right"), [], "default right");
@@ -17724,7 +17875,7 @@ QUnit.test("getContainerContent - navigation with page.navigationButtonsVisibili
assert.deepEqual(getContainerContent("contentTop"), [], "default contentTop");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "default contentBottom");
assert.deepEqual(getContainerContent("left"), [], "default left");
assert.deepEqual(getContainerContent("right"), [], "default right");
@@ -18529,7 +18680,113 @@ QUnit.test("emptySurveyText, make it writable, #7456", function (assert) {
assert.equal(survey.emptySurveyText, defaultText, "#3");
});
+QUnit.test("getContainerContent - progress + advanced header (legacyProgressBarView)", function (assert) {
+ const json = {
+ title: "My Survey",
+ showNavigationButtons: "none",
+ pages: [
+ {
+ "elements": [
+ {
+ required: true,
+ "type": "rating",
+ "name": "satisfaction",
+ },
+ {
+ required: true,
+ "type": "rating",
+ "name": "recommend friends",
+ }
+ ]
+ },
+ {
+ "elements": [
+ {
+ "type": "radiogroup",
+ "name": "price to competitors",
+ },
+ {
+ "type": "radiogroup",
+ "name": "price",
+ },
+ ]
+ },
+ ]
+ };
+
+ try {
+ settings.legacyProgressBarView = true;
+
+ let survey = new SurveyModel(json);
+ survey.headerView = "advanced";
+ const getContainerContent = getContainerContentFunction(survey);
+
+ assert.equal(survey.showNavigationButtons, "none");
+ assert.equal(survey.progressBarType, "pages");
+ assert.equal(survey.showProgressBar, "off");
+
+ assert.deepEqual(getContainerContent("header"), [{
+ "component": "sv-header",
+ "container": "header",
+ "id": "advanced-header",
+ "index": -100
+ }], "default header");
+ assert.deepEqual(getContainerContent("center"), [], "default center");
+ assert.deepEqual(getContainerContent("footer"), [], "default footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "default contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "default contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "default left");
+ assert.deepEqual(getContainerContent("right"), [], "default right");
+
+ survey.showProgressBar = "top";
+ assert.deepEqual(getContainerContent("header"), [{
+ "component": "sv-header",
+ "container": "header",
+ "id": "advanced-header",
+ "index": -100
+ }], "progress top header alone");
+ assert.deepEqual(getContainerContent("center"), [{
+ "component": "sv-progress-pages",
+ "id": "progress-pages"
+ }], "progress top center alone");
+ assert.deepEqual(getContainerContent("footer"), [], "progress top footer alone");
+ assert.deepEqual(getContainerContent("contentTop"), [], "progress top contentTop alone");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "progress top contentBottom alone");
+ assert.deepEqual(getContainerContent("left"), [], "progress top left alone");
+ assert.deepEqual(getContainerContent("right"), [], "progress top right alone");
+
+ survey.applyTheme({
+ header: {},
+ cssVariables: {
+ "--sjs-header-backcolor": "transparent"
+ }
+ } as any);
+ assert.deepEqual(getContainerContent("header"), [{
+ "component": "sv-progress-pages",
+ "id": "progress-pages",
+ "index": -150
+ }, {
+ "component": "sv-header",
+ "container": "header",
+ "id": "advanced-header",
+ "index": -100
+ }], "progress top header");
+ assert.deepEqual(getContainerContent("center"), [], "progress top center");
+ assert.deepEqual(getContainerContent("footer"), [], "progress top footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "progress top contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "progress top contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "progress top left");
+ assert.deepEqual(getContainerContent("right"), [], "progress top right");
+
+ }
+ finally {
+ settings.legacyProgressBarView = false;
+ }
+
+});
+
QUnit.test("getContainerContent - progress + advanced header", function (assert) {
+ surveyCss.currentType = "defaultV2";
const json = {
title: "My Survey",
showNavigationButtons: "none",
@@ -18592,8 +18849,8 @@ QUnit.test("getContainerContent - progress + advanced header", function (assert)
"index": -100
}], "progress top header alone");
assert.deepEqual(getContainerContent("center"), [{
- "component": "sv-progress-pages",
- "id": "progress-pages"
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons"
}], "progress top center alone");
assert.deepEqual(getContainerContent("footer"), [], "progress top footer alone");
assert.deepEqual(getContainerContent("contentTop"), [], "progress top contentTop alone");
@@ -18608,8 +18865,8 @@ QUnit.test("getContainerContent - progress + advanced header", function (assert)
}
} as any);
assert.deepEqual(getContainerContent("header"), [{
- "component": "sv-progress-pages",
- "id": "progress-pages",
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons",
"index": -150
}, {
"component": "sv-header",
@@ -18664,7 +18921,7 @@ QUnit.test("getContainerContent - do not show timer panel in display mode", func
assert.deepEqual(getContainerContent("contentTop"), [], "default contentTop");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "default contentBottom");
assert.deepEqual(getContainerContent("left"), [], "default left");
assert.deepEqual(getContainerContent("right"), [], "default right");
@@ -18676,7 +18933,7 @@ QUnit.test("getContainerContent - do not show timer panel in display mode", func
assert.deepEqual(getContainerContent("contentTop"), [], "default contentTop");
assert.deepEqual(getContainerContent("contentBottom"), [{
"component": "sv-action-bar",
- "id": "navigationbuttons"
+ "id": "buttons-navigation"
}], "default contentBottom");
assert.deepEqual(getContainerContent("left"), [], "default left");
assert.deepEqual(getContainerContent("right"), [], "default right");
@@ -18765,6 +19022,128 @@ QUnit.test("element.wasREndered", function (assert) {
assert.equal(panel2.wasRendered, true, "panel2 wasRendered, #2");
assert.equal(q6.wasRendered, true, "q6 wasRendered, #2");
});
+
+QUnit.test("getContainerContent - progress settings", function (assert) {
+ surveyCss.currentType = "defaultV2";
+ const json = {
+ showNavigationButtons: "none",
+ pages: [
+ {
+ "elements": [
+ {
+ required: true,
+ "type": "rating",
+ "name": "satisfaction",
+ },
+ {
+ required: true,
+ "type": "rating",
+ "name": "recommend friends",
+ }
+ ]
+ },
+ {
+ "elements": [
+ {
+ "type": "radiogroup",
+ "name": "price to competitors",
+ },
+ {
+ "type": "radiogroup",
+ "name": "price",
+ },
+ ]
+ },
+ ]
+ };
+
+ let survey = new SurveyModel(json);
+ const getContainerContent = getContainerContentFunction(survey);
+
+ assert.equal(settings.legacyProgressBarView, false, "show buttons progress for pages by default");
+ assert.equal(survey.showProgressBar, "off", "default show progress bar");
+ assert.equal(survey.progressBarType, "pages", "default progress bar type");
+ assert.equal(survey.progressBarShowPageNumbers, false, "don't show page numbers in progress by default");
+ assert.equal(survey.progressBarShowPageTitles, false, "don't show page titles in progress by default");
+
+ assert.deepEqual(getContainerContent("header"), [], "empty header");
+ assert.deepEqual(getContainerContent("footer"), [], "empty footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "empty contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "empty contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "empty left");
+ assert.deepEqual(getContainerContent("right"), [], "empty right");
+ assert.deepEqual(getContainerContent("center"), [], "empty center");
+
+ survey.showProgressBar = "auto";
+ assert.deepEqual(getContainerContent("header"), [], "auto pages header");
+ assert.deepEqual(getContainerContent("footer"), [], "auto pages footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "auto pages contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "auto pages contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "auto pages left");
+ assert.deepEqual(getContainerContent("right"), [], "auto pages right");
+ assert.deepEqual(getContainerContent("center"), [{
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons"
+ }], "auto pages center");
+
+ survey.progressBarType = "buttons";
+
+ assert.equal(survey.progressBarShowPageTitles, true, "show page titles in progress for buttons");
+
+ assert.deepEqual(getContainerContent("header"), [], "auto buttons header");
+ assert.deepEqual(getContainerContent("footer"), [], "auto buttons footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "auto buttons contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "auto buttons contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "auto buttons left");
+ assert.deepEqual(getContainerContent("right"), [], "auto buttons right");
+ assert.deepEqual(getContainerContent("center"), [{
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons"
+ }], "auto buttons center");
+
+ survey.progressBarType = "pages";
+
+ survey.showProgressBar = "aboveHeader";
+ assert.deepEqual(getContainerContent("header"), [{
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons",
+ "index": -150
+ }], "aboveHeader pages header");
+ assert.deepEqual(getContainerContent("footer"), [], "aboveHeader pages footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "aboveHeader pages contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "aboveHeader pages contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "aboveHeader pages left");
+ assert.deepEqual(getContainerContent("right"), [], "aboveHeader pages right");
+ assert.deepEqual(getContainerContent("center"), [], "aboveHeader pages center");
+
+ survey.showProgressBar = "belowHeader";
+ assert.deepEqual(getContainerContent("header"), [], "belowHeader pages header");
+ assert.deepEqual(getContainerContent("footer"), [], "belowHeader pages footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "belowHeader pages contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "belowHeader pages contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "belowHeader pages left");
+ assert.deepEqual(getContainerContent("right"), [], "belowHeader pages right");
+ assert.deepEqual(getContainerContent("center"), [{
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons"
+ }], "belowHeader pages center");
+
+ survey.showProgressBar = "topBottom";
+ assert.deepEqual(getContainerContent("header"), [], "topBottom pages header");
+ assert.deepEqual(getContainerContent("footer"), [{
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons"
+ }], "topBottom pages footer");
+ assert.deepEqual(getContainerContent("contentTop"), [], "topBottom pages contentTop");
+ assert.deepEqual(getContainerContent("contentBottom"), [], "topBottom pages contentBottom");
+ assert.deepEqual(getContainerContent("left"), [], "topBottom pages left");
+ assert.deepEqual(getContainerContent("right"), [], "topBottom pages right");
+ assert.deepEqual(getContainerContent("center"), [{
+ "component": "sv-progress-buttons",
+ "id": "progress-buttons"
+ }], "topBottom pages center");
+});
+
QUnit.test("survey.runExpressions(), #7694", function (assert) {
function func1(params: any[]): any {
return 1;
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-custom-navigation.png b/visualRegressionTests/tests/defaultV2/etalons/survey-custom-navigation.png
index 8d21f0cc58..ed8088ffdf 100644
Binary files a/visualRegressionTests/tests/defaultV2/etalons/survey-custom-navigation.png and b/visualRegressionTests/tests/defaultV2/etalons/survey-custom-navigation.png differ
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-bottom-brand.png b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-bottom-brand.png
index 53eabc4bc0..d3598c84d7 100644
Binary files a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-bottom-brand.png and b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-bottom-brand.png differ
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-bottom.png b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-bottom.png
index 63633bd1de..53d49bfa49 100644
Binary files a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-bottom.png and b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-bottom.png differ
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-and-toc.png b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-and-toc.png
index 7153e30d1e..695384dd23 100644
Binary files a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-and-toc.png and b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-and-toc.png differ
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-bottom-buttons-mobile.png b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-bottom-buttons-mobile.png
new file mode 100644
index 0000000000..0cccc025bc
Binary files /dev/null and b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-bottom-buttons-mobile.png differ
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-bottom-buttons.png b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-bottom-buttons.png
new file mode 100644
index 0000000000..76cc857e79
Binary files /dev/null and b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-bottom-buttons.png differ
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-buttons-mobile.png b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-buttons-mobile.png
new file mode 100644
index 0000000000..4cf9d9aad3
Binary files /dev/null and b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-buttons-mobile.png differ
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-buttons.png b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-buttons.png
index 570c8bf3e0..8f24a09d0f 100644
Binary files a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-buttons.png and b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-buttons.png differ
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-numbered-buttons-mobile.png b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-numbered-buttons-mobile.png
new file mode 100644
index 0000000000..f3c0f1885b
Binary files /dev/null and b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-numbered-buttons-mobile.png differ
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-numbered-buttons.png b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-numbered-buttons.png
new file mode 100644
index 0000000000..73057de02e
Binary files /dev/null and b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top-numbered-buttons.png differ
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top.png b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top.png
index bb4a6c0019..621d0f14f9 100644
Binary files a/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top.png and b/visualRegressionTests/tests/defaultV2/etalons/survey-progress-bar-top.png differ
diff --git a/visualRegressionTests/tests/defaultV2/etalons/survey-without-tilte-and-with-progress.png b/visualRegressionTests/tests/defaultV2/etalons/survey-without-tilte-and-with-progress.png
index 1e94d22070..b0c13be360 100644
Binary files a/visualRegressionTests/tests/defaultV2/etalons/survey-without-tilte-and-with-progress.png and b/visualRegressionTests/tests/defaultV2/etalons/survey-without-tilte-and-with-progress.png differ
diff --git a/visualRegressionTests/tests/defaultV2/progress.ts b/visualRegressionTests/tests/defaultV2/progress.ts
new file mode 100644
index 0000000000..b0c79946fd
--- /dev/null
+++ b/visualRegressionTests/tests/defaultV2/progress.ts
@@ -0,0 +1,293 @@
+import { Selector, ClientFunction } from "testcafe";
+import { setData } from "../../../testCafe/helper";
+import { url, frameworks, initSurvey, url_test, takeElementScreenshot, wrapVisualTest, resetFocusToBody, resetHoverToBody } from "../../helper";
+import { backgroundImage } from "../../constants";
+
+const title = "Survey Progress Screenshot";
+const theme = "defaultV2";
+
+const applyTheme = ClientFunction(theme => {
+ (
window).Survey.StylesManager.applyTheme(theme);
+});
+
+const testedPages = [{
+ name: "page1",
+ title: "Test",
+ elements: [
+ {
+ name: "q1",
+ type: "text"
+ }
+ ]
+}];
+
+const json = {
+ focusFirstQuestionAutomatic: true,
+ "title": "Minimum data reporting form – for suspected and probable cases of COVID-19",
+ "pages": [{
+ "name": "page1",
+ "navigationTitle": "Sign In",
+ "navigationDescription": "... to continue purchasing.",
+ "elements": [
+ {
+ "name": "q1",
+ type: "text"
+ }
+ ]
+ }, {
+ "name": "page2",
+ "navigationTitle": "Shipping information",
+ "title": "Shipping",
+ "navigationDescription": "Enter shipping information.",
+ "elements": [
+ {
+ "type": "radiogroup",
+ "name": "q1",
+ "title": "Select a shipping method.",
+ "choices": ["FedEx", "DHL", "USP", "In-Store Pickup"]
+ },
+ ]
+ }, {
+ "name": "page3",
+ "navigationTitle": "Payment method",
+ "navigationDescription": "Select a payment method.",
+ "elements": [
+ {
+ "name": "q1",
+ type: "text"
+ }
+ ]
+ }, {
+ "name": "page4",
+ "navigationTitle": "Gift Options",
+ "navigationDescription": "Choose your gift.",
+ "elements": [
+ {
+ "name": "q1",
+ type: "text"
+ }
+ ]
+ }, {
+ "name": "page5",
+ "navigationTitle": "Place Order",
+ "navigationDescription": "Finish your purchasing.",
+ "elements": [{
+ "name": "q1",
+ type: "text"
+ }]
+ }],
+ "showProgressBar": "top",
+ "progressBarType": "buttons"
+};
+
+fixture`${title}`.page`${url}`;
+
+frameworks.forEach(framework => {
+ fixture`${framework} ${title} ${theme}`
+ .page`${url_test}${theme}/${framework}`
+ .beforeEach(async t => {
+ await applyTheme(theme);
+ });
+
+ test("Check survey with progress top", async (t) => {
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1920, 1080);
+ await initSurvey(framework, json);
+ await ClientFunction(() => {
+ (window).survey.progressBarType = "pages";
+ (window).survey.currentPageNo = 1;
+ })();
+ await takeElementScreenshot("survey-progress-bar-top.png", Selector(".sd-container-modern"), t, comparer); // title + progress
+ });
+ });
+ test("Check survey with progress bottom", async (t) => {
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1920, 1080);
+ await initSurvey(framework, json);
+ await ClientFunction(() => {
+ (window).survey.showProgressBar = "bottom";
+ (window).survey.progressBarType = "pages";
+ (window).survey.currentPageNo = 1;
+ })();
+ await takeElementScreenshot("survey-progress-bar-bottom.png", Selector(".sd-container-modern"), t, comparer); // title + progress
+ });
+ });
+ test("Check survey with progress bottom with brand info and fit to container", async (t) => {
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1800, 900);
+ await initSurvey(framework, json);
+ await ClientFunction(() => {
+ const container = (window).document.getElementById("surveyElement");
+ container.style.position = "fixed";
+ container.style.top = 0;
+ container.style.bottom = 0;
+ container.style.left = 0;
+ container.style.right = 0;
+ (window).survey.showBrandInfo = true;
+ (window).survey.fitToContainer = true;
+ (window).survey.showProgressBar = "bottom";
+ (window).survey.progressBarType = "pages";
+ (window).survey.currentPageNo = 1;
+ })();
+ await takeElementScreenshot("survey-progress-bar-bottom-brand.png", Selector("#surveyElement"), t, comparer); // title + progress
+ });
+ });
+ test("Check survey with progress top buttons", async (t) => {
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1920, 1080);
+ await initSurvey(framework, json);
+ await t.click(Selector("li").nth(1));
+ await takeElementScreenshot("survey-progress-bar-top-buttons.png", Selector(".sd-container-modern"), t, comparer);
+ await t.resizeWindow(500, 1080);
+ await takeElementScreenshot("survey-progress-bar-top-buttons-mobile.png", Selector(".sd-container-modern"), t, comparer);
+ });
+ });
+ test("Check survey with progress top buttons with numbers", async (t) => {
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1920, 1080);
+ await initSurvey(framework, json);
+ await ClientFunction(() => {
+ (window).survey.progressBarShowPageNumbers = true;
+ })();
+ await t.click(Selector("li").nth(1));
+ await takeElementScreenshot("survey-progress-bar-top-numbered-buttons.png", Selector(".sd-container-modern"), t, comparer);
+ await t.resizeWindow(500, 1080);
+ await takeElementScreenshot("survey-progress-bar-top-numbered-buttons-mobile.png", Selector(".sd-container-modern"), t, comparer);
+ });
+ });
+ test("Check survey with progress top and bottom buttons", async (t) => {
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1920, 1080);
+ await initSurvey(framework, json);
+ await ClientFunction(() => {
+ (window).survey.showProgressBar = "topBottom";
+ })();
+ await t.click(Selector("li").nth(1));
+ await takeElementScreenshot("survey-progress-bar-top-bottom-buttons.png", Selector(".sd-container-modern"), t, comparer);
+ await t.resizeWindow(500, 1080);
+ await takeElementScreenshot("survey-progress-bar-top-bottom-buttons-mobile.png", Selector(".sd-container-modern"), t, comparer);
+ });
+ });
+ test("Check survey with progress top and TOC", async (t) => {
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1920, 1080);
+ await initSurvey(framework, json);
+ await ClientFunction(() => {
+ (window).survey.showTOC = true;
+ (window).survey.progressBarType = "pages";
+ (window).survey.currentPageNo = 1;
+ })();
+ await takeElementScreenshot("survey-progress-bar-top-and-toc.png", Selector(".sd-container-modern"), t, comparer); // title + progress
+ });
+ });
+ test("Check survey without title and with progress", async (t) => {
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1920, 1080);
+ await initSurvey(framework, {
+ focusFirstQuestionAutomatic: true,
+ pages: testedPages,
+ showProgressBar: "top"
+ });
+ await takeElementScreenshot("survey-without-tilte-and-with-progress.png", Selector(".sd-container-modern"), t, comparer); // progress
+ });
+ });
+ test("Check survey without title and progress", async (t) => {
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1920, 1080);
+ await initSurvey(framework, {
+ focusFirstQuestionAutomatic: true,
+ pages: testedPages
+ });
+ await takeElementScreenshot("survey-without-tilte-and-progress.png", Selector(".sd-container-modern"), t, comparer); // without title and progress
+ });
+ });
+ test("Check survey with title and without progress", async (t) => {
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1920, 1080);
+ await initSurvey(framework, {
+ focusFirstQuestionAutomatic: true,
+ title: "Test",
+ pages: testedPages
+ });
+ await takeElementScreenshot("survey-with-tilte-and-without-progress.png", Selector(".sd-container-modern"), t, comparer); // title
+ });
+ });
+ test("Check survey progress bar freezes on top", async (t) => {
+ if (framework in ["knockout", "react", "angular"]) { // TODO: reanimate Vue after Vue3 supported
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1500, 720);
+ const json = {
+ "title": "American History",
+ "showProgressBar": "top",
+ "pages": [
+ {
+ "elements": [
+ {
+ "type": "radiogroup",
+ "name": "civilwar",
+ "title": "When was the American Civil War?",
+ "choices": [
+ "1796-1803",
+ "1810-1814",
+ "1861-1865",
+ "1939-1945"
+ ],
+ "correctAnswer": "1861-1865"
+ },
+ {
+ "type": "radiogroup",
+ "name": "libertyordeath",
+ "title": "Whose quote is this: \"Give me liberty, or give me death\"?",
+ "choices": [
+ "John Hancock",
+ "James Madison",
+ "Patrick Henry",
+ "Samuel Adams"
+ ],
+ "correctAnswer": "Patrick Henry"
+ },
+ {
+ "type": "radiogroup",
+ "name": "magnacarta",
+ "title": "What is Magna Carta?",
+ "choices": [
+ "The foundation of the British parliamentary system",
+ "The Great Seal of the monarchs of England",
+ "The French Declaration of the Rights of Man",
+ "The charter signed by the Pilgrims on the Mayflower"
+ ],
+ "correctAnswer": "The foundation of the British parliamentary system"
+ }
+ ]
+ }
+ ]
+ };
+ await initSurvey(framework, json);
+ await ClientFunction(() => {
+ const surveyElement = document.getElementById("surveyElement");
+ if (surveyElement) {
+ surveyElement.style.height = "90vh";
+ surveyElement.style.overflowY = "auto";
+ document.querySelector("[data-name='libertyordeath']")?.scrollIntoView(true);
+ }
+ })();
+ await takeElementScreenshot("survey-progress-top-freeze.png", Selector("body"), t, comparer);
+ });
+ }
+ });
+ test("Check survey with custom navigation", async (t) => {
+ await wrapVisualTest(t, async (t, comparer) => {
+ await t.resizeWindow(1920, 1080);
+ await initSurvey(framework, json);
+ await ClientFunction(() => {
+ (window).survey.progressBarType = "pages";
+ (window).survey.currentPageNo = 1;
+ (window).survey.addNavigationItem({
+ title: "Save",
+ action: () => { }
+ });
+ })();
+ await takeElementScreenshot("survey-custom-navigation.png", Selector(".sd-container-modern"), t, comparer);
+ });
+ });
+});
\ No newline at end of file
diff --git a/visualRegressionTests/tests/defaultV2/survey.ts b/visualRegressionTests/tests/defaultV2/survey.ts
index cdfd599f42..dcfe6217ff 100644
--- a/visualRegressionTests/tests/defaultV2/survey.ts
+++ b/visualRegressionTests/tests/defaultV2/survey.ts
@@ -183,84 +183,6 @@ frameworks.forEach(framework => {
await takeElementScreenshot("survey-advanced-header-mobile-background.png", Selector(".sd-root-modern"), t, comparer);
});
});
- test("Check survey with progress top", async (t) => {
- await wrapVisualTest(t, async (t, comparer) => {
- await t.resizeWindow(1920, 1080);
- await initSurvey(framework, json);
- await ClientFunction(() => {
- (window).survey.progressBarType = "pages";
- (window).survey.currentPageNo = 1;
- })();
- await takeElementScreenshot("survey-progress-bar-top.png", Selector(".sd-container-modern"), t, comparer); // title + progress
- });
- });
- test("Check survey with progress bottom", async (t) => {
- await wrapVisualTest(t, async (t, comparer) => {
- await t.resizeWindow(1920, 1080);
- await initSurvey(framework, json);
- await ClientFunction(() => {
- (window).survey.showProgressBar = "bottom";
- (window).survey.progressBarType = "pages";
- (window).survey.currentPageNo = 1;
- })();
- await takeElementScreenshot("survey-progress-bar-bottom.png", Selector(".sd-container-modern"), t, comparer); // title + progress
- });
- });
- test("Check survey with progress bottom with brand info and fit to container", async (t) => {
- await wrapVisualTest(t, async (t, comparer) => {
- await t.resizeWindow(1800, 900);
- await initSurvey(framework, json);
- await ClientFunction(() => {
- const container = (window).document.getElementById("surveyElement");
- container.style.position = "fixed";
- container.style.top = 0;
- container.style.bottom = 0;
- container.style.left = 0;
- container.style.right = 0;
- (window).survey.showBrandInfo = true;
- (window).survey.fitToContainer = true;
- (window).survey.showProgressBar = "bottom";
- (window).survey.progressBarType = "pages";
- (window).survey.currentPageNo = 1;
- })();
- await takeElementScreenshot("survey-progress-bar-bottom-brand.png", Selector("#surveyElement"), t, comparer); // title + progress
- });
- });
- test("Check survey with progress top buttons", async (t) => {
- await wrapVisualTest(t, async (t, comparer) => {
- await t.resizeWindow(1920, 1080);
- await initSurvey(framework, json);
- await t.click(Selector("li").nth(1));
- await takeElementScreenshot("survey-progress-bar-top-buttons.png", Selector(".sd-container-modern"), t, comparer);
- });
- });
- test("Check survey with custom navigation", async (t) => {
- await wrapVisualTest(t, async (t, comparer) => {
- await t.resizeWindow(1920, 1080);
- await initSurvey(framework, json);
- await ClientFunction(() => {
- (window).survey.progressBarType = "pages";
- (window).survey.currentPageNo = 1;
- (window).survey.addNavigationItem({
- title: "Save",
- action: () => { }
- });
- })();
- await takeElementScreenshot("survey-custom-navigation.png", Selector(".sd-container-modern"), t, comparer);
- });
- });
- test("Check survey with progress top and TOC", async (t) => {
- await wrapVisualTest(t, async (t, comparer) => {
- await t.resizeWindow(1920, 1080);
- await initSurvey(framework, json);
- await ClientFunction(() => {
- (window).survey.showTOC = true;
- (window).survey.progressBarType = "pages";
- (window).survey.currentPageNo = 1;
- })();
- await takeElementScreenshot("survey-progress-bar-top-and-toc.png", Selector(".sd-container-modern"), t, comparer); // title + progress
- });
- });
const testedPages = [{
name: "page1",
@@ -273,38 +195,6 @@ frameworks.forEach(framework => {
]
}];
- test("Check survey without title and with progress", async (t) => {
- await wrapVisualTest(t, async (t, comparer) => {
- await t.resizeWindow(1920, 1080);
- await initSurvey(framework, {
- focusFirstQuestionAutomatic: true,
- pages: testedPages,
- showProgressBar: "top"
- });
- await takeElementScreenshot("survey-without-tilte-and-with-progress.png", Selector(".sd-container-modern"), t, comparer); // progress
- });
- });
- test("Check survey without title and progress", async (t) => {
- await wrapVisualTest(t, async (t, comparer) => {
- await t.resizeWindow(1920, 1080);
- await initSurvey(framework, {
- focusFirstQuestionAutomatic: true,
- pages: testedPages
- });
- await takeElementScreenshot("survey-without-tilte-and-progress.png", Selector(".sd-container-modern"), t, comparer); // without title and progress
- });
- });
- test("Check survey with title and without progress", async (t) => {
- await wrapVisualTest(t, async (t, comparer) => {
- await t.resizeWindow(1920, 1080);
- await initSurvey(framework, {
- focusFirstQuestionAutomatic: true,
- title: "Test",
- pages: testedPages
- });
- await takeElementScreenshot("survey-with-tilte-and-without-progress.png", Selector(".sd-container-modern"), t, comparer); // title
- });
- });
test("Check survey with width", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1920, 1080);
@@ -666,69 +556,6 @@ frameworks.forEach(framework => {
await takeElementScreenshot("survey-timer-without-progress.png", Selector("body"), t, comparer);
});
});
- test("Check survey progress bar freezes on top", async (t) => {
- if (framework in ["knockout", "react", "angular"]) { // TODO: reanimate Vue after Vue3 supported
- await wrapVisualTest(t, async (t, comparer) => {
- await t.resizeWindow(1500, 720);
- const json = {
- "title": "American History",
- "showProgressBar": "top",
- "pages": [
- {
- "elements": [
- {
- "type": "radiogroup",
- "name": "civilwar",
- "title": "When was the American Civil War?",
- "choices": [
- "1796-1803",
- "1810-1814",
- "1861-1865",
- "1939-1945"
- ],
- "correctAnswer": "1861-1865"
- },
- {
- "type": "radiogroup",
- "name": "libertyordeath",
- "title": "Whose quote is this: \"Give me liberty, or give me death\"?",
- "choices": [
- "John Hancock",
- "James Madison",
- "Patrick Henry",
- "Samuel Adams"
- ],
- "correctAnswer": "Patrick Henry"
- },
- {
- "type": "radiogroup",
- "name": "magnacarta",
- "title": "What is Magna Carta?",
- "choices": [
- "The foundation of the British parliamentary system",
- "The Great Seal of the monarchs of England",
- "The French Declaration of the Rights of Man",
- "The charter signed by the Pilgrims on the Mayflower"
- ],
- "correctAnswer": "The foundation of the British parliamentary system"
- }
- ]
- }
- ]
- };
- await initSurvey(framework, json);
- await ClientFunction(() => {
- const surveyElement = document.getElementById("surveyElement");
- if (surveyElement) {
- surveyElement.style.height = "90vh";
- surveyElement.style.overflowY = "auto";
- document.querySelector("[data-name='libertyordeath']")?.scrollIntoView(true);
- }
- })();
- await takeElementScreenshot("survey-progress-top-freeze.png", Selector("body"), t, comparer);
- });
- }
- });
const notifierJson = {
"pages": [
@@ -1533,4 +1360,3 @@ frameworks.forEach(framework => {
});
});
});
-