From c9603f150ae3f83d8c24382e25cf32de38224265 Mon Sep 17 00:00:00 2001 From: Aleksey Novikov Date: Fri, 6 Oct 2023 17:15:47 +0300 Subject: [PATCH 1/4] Panel Dynamic - Inner Fields overlap available screen area (#7081) * Panel Dynamic - Inner Fields overlap available screen area Fixes #5935 * #5935 - set survey width for tests * #5935 - fixed width auto style * #5935 fixed unit tests * #5935 - wider surveys in tests * #5935 - upgrade screenshot tests * #use current chrome in markup tests * #5935 - update f-test * #5935 update screenshots --------- Co-authored-by: Aleksey Novikov --- build-scripts/karma.conf.js | 2 +- src/question.ts | 1 - src/survey-element.ts | 4 ++-- testCafe/survey/surveyWidth.ts | 4 ++-- tests/markup/etalon_paneldynamic.ts | 2 +- .../snapshots/page-swnl-title-v2.snap.html | 4 ++-- tests/markup/snapshots/page-swnl-v2.snap.html | 4 ++-- .../markup/snapshots/page-title-v2.snap.html | 2 +- .../panel-page-swnl-title-v2.snap.html | 4 ++-- .../snapshots/panel-page-swnl-v2.snap.html | 4 ++-- .../panel-question-headers.snap.html | 2 +- .../markup/snapshots/panel-swnl-v2.snap.html | 2 +- tests/markup/snapshots/panel-text.snap.html | 2 +- tests/markup/snapshots/panel.snap.html | 2 +- .../paneldynamic-no-footer-1.snap.html | 2 +- .../paneldynamic-no-footer-2.snap.html | 2 +- ...neldynamic-remove-btn-action-bar.snap.html | 2 +- .../paneldynamic-remove-btn-right.snap.html | 2 +- .../question-errors-v2-bottom.snap.html | 2 +- .../question-errors-v2-top.snap.html | 2 +- .../snapshots/question-with-indent.snap.html | 2 +- .../snapshots/survey-navigation.snap.html | 2 +- tests/surveyElementTests.ts | 6 ++---- tests/surveytests.ts | 4 ---- .../tests/defaultV2/boolean.ts | 1 + .../tests/defaultV2/complex.ts | 1 + .../file-question-single-file-small-image.png | Bin 74741 -> 73970 bytes ...-question-single-file-small-image_mask.png | Bin 0 -> 2512 bytes .../etalons/survey-with-panel-compact.png | Bin 31717 -> 31715 bytes .../two-panels-one-row-small-screen.png | Bin 9390 -> 8002 bytes visualRegressionTests/tests/defaultV2/file.ts | 3 +++ visualRegressionTests/tests/defaultV2/html.ts | 2 ++ .../tests/defaultV2/image.ts | 1 + .../tests/defaultV2/matrixdynamic.ts | 4 ++++ .../tests/defaultV2/multipletext.ts | 2 ++ .../tests/defaultV2/panel.ts | 8 ++++++++ .../tests/defaultV2/paneldynamic.ts | 1 + .../tests/defaultV2/question.ts | 8 ++++++++ .../tests/defaultV2/rating.ts | 14 ++++++++++++++ 39 files changed, 74 insertions(+), 36 deletions(-) create mode 100644 visualRegressionTests/tests/defaultV2/etalons/file-question-single-file-small-image_mask.png diff --git a/build-scripts/karma.conf.js b/build-scripts/karma.conf.js index 62e92bf9ac..bfc07ba41e 100644 --- a/build-scripts/karma.conf.js +++ b/build-scripts/karma.conf.js @@ -9,7 +9,7 @@ var webpackConfig = webpackConfigCreator({ packageJson ); -process.env.CHROME_BIN = require("puppeteer").executablePath(); +//process.env.CHROME_BIN = require("puppeteer").executablePath(); /*setup ts config file for tests ("noImplicitAny": false)*/ webpackConfig.module.rules[0].options.configFile = "build-scripts/tsconfig.tests.json"; diff --git a/src/question.ts b/src/question.ts index 17ba3ca7a8..5f0aeb3f97 100644 --- a/src/question.ts +++ b/src/question.ts @@ -112,7 +112,6 @@ export class Question extends SurveyElement } public setIsMobile(val: boolean) { this.isMobile = val && (this.allowMobileInDesignMode() || !this.isDesignMode); - this.renderMinWidth = !val; } @property({ defaultValue: false }) isMobile: boolean; @property() forceIsInputReadOnly: boolean; diff --git a/src/survey-element.ts b/src/survey-element.ts index 2a36459687..c6c31bd19a 100644 --- a/src/survey-element.ts +++ b/src/survey-element.ts @@ -908,11 +908,11 @@ export class SurveyElement extends SurveyElementCore implements ISurvey } @property({ defaultValue: true }) allowRootStyle: boolean; - @property({ defaultValue: true }) renderMinWidth: boolean; get rootStyle() { let style: { [index: string]: any } = {}; - let minWidth = this.renderMinWidth ? this.minWidth : "min(100%, " + this.minWidth + ")"; + let minWidth = this.minWidth; + if (minWidth != "auto") minWidth = "min(100%, " + this.minWidth + ")"; if (this.allowRootStyle && this.renderWidth) { // style["width"] = this.renderWidth; style["flexGrow"] = 1; diff --git a/testCafe/survey/surveyWidth.ts b/testCafe/survey/surveyWidth.ts index 46655af820..22c8f1bc2d 100644 --- a/testCafe/survey/surveyWidth.ts +++ b/testCafe/survey/surveyWidth.ts @@ -26,10 +26,10 @@ frameworks.forEach((framework) => { test("Check question width", async (t) => { await t - .expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("300px"); + .expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("min(100% + 0px, 0% + 300px)"); await ClientFunction(() => { window["survey"].getAllQuestions()[0].minWidth = "200px"; })(); await t - .expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("200px"); + .expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("min(100% + 0px, 0% + 200px)"); }); }); \ No newline at end of file diff --git a/tests/markup/etalon_paneldynamic.ts b/tests/markup/etalon_paneldynamic.ts index da5022c64d..26d96b16c4 100644 --- a/tests/markup/etalon_paneldynamic.ts +++ b/tests/markup/etalon_paneldynamic.ts @@ -176,7 +176,7 @@ registerMarkupTests( snapshot: "paneldynamic-no-footer-1", removeIds: true, excludePlatform: "Vue", - before: () => StylesManager.applyTheme("defaultV2"), + before: () => { StylesManager.applyTheme("defaultV2"); }, after: () => StylesManager.applyTheme("default"), }, { diff --git a/tests/markup/snapshots/page-swnl-title-v2.snap.html b/tests/markup/snapshots/page-swnl-title-v2.snap.html index e7982b0968..10bd8205a1 100644 --- a/tests/markup/snapshots/page-swnl-title-v2.snap.html +++ b/tests/markup/snapshots/page-swnl-title-v2.snap.html @@ -1,4 +1,4 @@ -
+
@@ -12,7 +12,7 @@
-
+
diff --git a/tests/markup/snapshots/page-swnl-v2.snap.html b/tests/markup/snapshots/page-swnl-v2.snap.html index 802bc70923..7b90de42d6 100644 --- a/tests/markup/snapshots/page-swnl-v2.snap.html +++ b/tests/markup/snapshots/page-swnl-v2.snap.html @@ -1,11 +1,11 @@ -
+
-
+