From bc7271dfa54ae314436f516240f1f744957c45a6 Mon Sep 17 00:00:00 2001 From: Dmitry Kuzin Date: Thu, 5 Jun 2025 19:45:03 +0400 Subject: [PATCH 1/5] Fix completed html strings and styles --- .../blocks/sd-completedpage.scss | 20 ++++++------------- .../survey-core/src/default-theme/mixins.scss | 11 ++++++---- packages/survey-core/src/localizablestring.ts | 4 ---- packages/survey-core/src/survey.ts | 13 ++++-------- packages/survey-core/tests/surveytests.ts | 8 -------- 5 files changed, 17 insertions(+), 39 deletions(-) diff --git a/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss b/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss index e275fd106e..e3ebf4a56b 100644 --- a/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss +++ b/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss @@ -2,6 +2,7 @@ @use "../mixins.scss" as mixins; .sd-completedpage, +.sd-body--loading, .sd-completed-before-page { align-items: center; font-family: $font-family; @@ -11,19 +12,10 @@ height: auto; @include mixins.articleHtml; } - -.sd-completedpage:before, -.sd-completedpage:after { - display: block; - width: calcSize(9); - margin-left: calc(50% - 4.5 * #{$base-unit}); - content: ""; +.sd-completedpage { + padding: calcSize(17) 0 calcSize(6) 0; } - -.sd-completedpage:before { - height: calcSize(13); +.sd-body--loading, +.sd-completed-before-page { + padding: calcSize(4) 0 calcSize(4) 0; } - -.sd-completedpage:after { - height: calcSize(2); -} \ No newline at end of file diff --git a/packages/survey-core/src/default-theme/mixins.scss b/packages/survey-core/src/default-theme/mixins.scss index 35bad6a9ea..ec66111f52 100644 --- a/packages/survey-core/src/default-theme/mixins.scss +++ b/packages/survey-core/src/default-theme/mixins.scss @@ -93,7 +93,7 @@ } @mixin articleHtml { - @include articleDefaultFont; + @include articleLargeFont; color: $font-pagetitle-color; h1 { @include articleXXLargeFont; @@ -102,7 +102,6 @@ h2 { @include articleXLargeFont; } - h3 { @include articleLargeFont; } @@ -144,7 +143,9 @@ font-size: $font-questiontitle-size; line-height: multiply(1.5, $font-questiontitle-size); - box-shadow: $shadow-small, 0 0 0 0px $primary; + box-shadow: + $shadow-small, + 0 0 0 0px $primary; transition: box-shadow $transition-duration; &:hover { @@ -152,7 +153,9 @@ } &:focus { - box-shadow: $shadow-small-reset, 0 0 0 2px $primary; + box-shadow: + $shadow-small-reset, + 0 0 0 2px $primary; } span { diff --git a/packages/survey-core/src/localizablestring.ts b/packages/survey-core/src/localizablestring.ts index 97e02e8463..0d98d1fcb8 100644 --- a/packages/survey-core/src/localizablestring.ts +++ b/packages/survey-core/src/localizablestring.ts @@ -61,7 +61,6 @@ export class LocalizableString implements ILocalizableString { public onGetTextCallback: (str: string, nonProcessedText?: string) => string; public storeDefaultText: boolean; public serializeCallBackText: boolean; - public onGetLocalizationTextCallback: (str: string) => string; public onStrChanged: (oldValue: string, newValue: string) => void; public lastChangedLoc: string; public onSearchChanged: () => void; @@ -155,9 +154,6 @@ export class LocalizableString implements ILocalizableString { } if (this.isValueEmpty(res) && !!this.getLocalizationName()) { res = this.getLocalizationStr(); - if (!!this.onGetLocalizationTextCallback) { - res = this.onGetLocalizationTextCallback(res); - } } if (!res) res = this.defaultValue || ""; return res; diff --git a/packages/survey-core/src/survey.ts b/packages/survey-core/src/survey.ts index 5b0119fe62..9e182e214b 100644 --- a/packages/survey-core/src/survey.ts +++ b/packages/survey-core/src/survey.ts @@ -950,10 +950,9 @@ export class SurveyModel extends SurveyElementCore // if (DomDocumentHelper.isAvailable()) { // SurveyModel.stylesManager = new StylesManager(); // } - const htmlCallBack = (str: string): string => { return "

" + str + "

"; }; - this.createHtmlLocString("completedHtml", "completingSurvey", htmlCallBack); - this.createHtmlLocString("completedBeforeHtml", "completingSurveyBefore", htmlCallBack, "completed-before"); - this.createHtmlLocString("loadingHtml", "loadingSurvey", htmlCallBack, "loading"); + this.createHtmlLocString("completedHtml", "completingSurvey"); + this.createHtmlLocString("completedBeforeHtml", "completingSurveyBefore", "completed-before"); + this.createHtmlLocString("loadingHtml", "loadingSurvey", "loading"); this.createLocalizableString("emptySurveyText", this, true, "emptySurvey"); this.createLocalizableString("logo", this, false); this.createLocalizableString("startSurveyText", this, false, true); @@ -1170,9 +1169,8 @@ export class SurveyModel extends SurveyElementCore } }; } - private createHtmlLocString(name: string, locName: string, func: (str: string) => string, reason?: string): void { + private createHtmlLocString(name: string, locName: string, reason?: string): void { const res = this.createLocalizableString(name, this, false, locName); - res.onGetLocalizationTextCallback = func; if (reason) { res.onGetTextCallback = (str: string): string => { return this.processHtml(str, reason); }; } @@ -2614,9 +2612,6 @@ export class SurveyModel extends SurveyElementCore get locLoadingHtml(): LocalizableString { return this.getLocalizableString("loadingHtml"); } - public get defaultLoadingHtml(): string { - return "

" + this.getLocalizationString("loadingSurvey") + "

"; - } public get navigationBar(): ActionContainer { if (!this.navigationBarValue) { this.navigationBarValue = this.createNavigationBar(); diff --git a/packages/survey-core/tests/surveytests.ts b/packages/survey-core/tests/surveytests.ts index 5bf39b72cd..b6823eb50f 100644 --- a/packages/survey-core/tests/surveytests.ts +++ b/packages/survey-core/tests/surveytests.ts @@ -3506,14 +3506,6 @@ QUnit.test("pre process title, 'locale' variable", function (assert) { ); }); -QUnit.test("Default value completedHtml, completedBeforeHtml and loadingHtml", function (assert) { - const survey = new SurveyModel(); - survey.locale = ""; - assert.ok(survey.completedHtml.indexOf("") > -1, "h3 is here, default completedHtml"); - assert.ok(survey.completedBeforeHtml.indexOf("") > -1, "h3 is here, default completedBeforeHtml"); - assert.ok(survey.loadingHtml.indexOf("") > -1, "h3 is here, default loadingHtml"); -}); - QUnit.test( "pre process title with variables in Capital letters, bug#1099", function (assert) { From 629ad948328f89e7f36fdbaf25bf0a3b06162300 Mon Sep 17 00:00:00 2001 From: Dmitry Kuzin Date: Mon, 9 Jun 2025 19:27:30 +0400 Subject: [PATCH 2/5] Fix scr tests --- .../src/default-theme/blocks/sd-completedpage.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss b/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss index e3ebf4a56b..342b801a49 100644 --- a/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss +++ b/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss @@ -13,9 +13,15 @@ @include mixins.articleHtml; } .sd-completedpage { + &:has(> *) { + padding: calcSize(13) 0 calcSize(2) 0; + } padding: calcSize(17) 0 calcSize(6) 0; } .sd-body--loading, .sd-completed-before-page { + &:has(> *) { + padding: 0; + } padding: calcSize(4) 0 calcSize(4) 0; } From ffab84671216d5fe05903a7633b4b7100a20eb72 Mon Sep 17 00:00:00 2001 From: Dmitry Kuzin Date: Mon, 9 Jun 2025 21:51:39 +0400 Subject: [PATCH 3/5] Fix scr tests --- .../src/default-theme/blocks/sd-completedpage.scss | 3 +++ packages/survey-core/src/default-theme/mixins.scss | 9 ++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss b/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss index 342b801a49..5c22d57909 100644 --- a/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss +++ b/packages/survey-core/src/default-theme/blocks/sd-completedpage.scss @@ -11,6 +11,9 @@ text-align: center; height: auto; @include mixins.articleHtml; + &:not(:has(> *)) { + @include mixins.articleLargeFont; + } } .sd-completedpage { &:has(> *) { diff --git a/packages/survey-core/src/default-theme/mixins.scss b/packages/survey-core/src/default-theme/mixins.scss index ec66111f52..9332d6e7de 100644 --- a/packages/survey-core/src/default-theme/mixins.scss +++ b/packages/survey-core/src/default-theme/mixins.scss @@ -93,7 +93,6 @@ } @mixin articleHtml { - @include articleLargeFont; color: $font-pagetitle-color; h1 { @include articleXXLargeFont; @@ -143,9 +142,7 @@ font-size: $font-questiontitle-size; line-height: multiply(1.5, $font-questiontitle-size); - box-shadow: - $shadow-small, - 0 0 0 0px $primary; + box-shadow: $shadow-small, 0 0 0 0px $primary; transition: box-shadow $transition-duration; &:hover { @@ -153,9 +150,7 @@ } &:focus { - box-shadow: - $shadow-small-reset, - 0 0 0 2px $primary; + box-shadow: $shadow-small-reset, 0 0 0 2px $primary; } span { From b510d63b19f24ebbe855b7667e71913d9799718f Mon Sep 17 00:00:00 2001 From: Dmitry Kuzin Date: Mon, 9 Jun 2025 21:55:46 +0400 Subject: [PATCH 4/5] Fix e2e test --- e2e/survey/cookie.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/survey/cookie.spec.ts b/e2e/survey/cookie.spec.ts index a5d07e90cf..5cf1be6f13 100644 --- a/e2e/survey/cookie.spec.ts +++ b/e2e/survey/cookie.spec.ts @@ -49,11 +49,11 @@ frameworks.forEach((framework) => { await page.goto(`${url}${framework}`); await initSurvey(page, framework, json); - await expect(page.locator(".sd-body h3").getByText("You have already completed this survey.")).toBeVisible(); + await expect(page.locator(".sd-body").getByText("You have already completed this survey.")).toBeVisible(); await deleteCookie(page); await firstElement.hover(); - await expect(page.locator(".sd-body h3").getByText("You have already completed this survey.")).not.toBeVisible(); + await expect(page.locator(".sd-body").getByText("You have already completed this survey.")).not.toBeVisible(); }); }); }); \ No newline at end of file From 25a25c246450d4298d0bea161e88918d768d1977 Mon Sep 17 00:00:00 2001 From: Dmitry Kuzin Date: Mon, 9 Jun 2025 22:46:47 +0400 Subject: [PATCH 5/5] Fix scr tests --- packages/survey-core/src/default-theme/mixins.scss | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/survey-core/src/default-theme/mixins.scss b/packages/survey-core/src/default-theme/mixins.scss index 9332d6e7de..9d144af566 100644 --- a/packages/survey-core/src/default-theme/mixins.scss +++ b/packages/survey-core/src/default-theme/mixins.scss @@ -93,6 +93,7 @@ } @mixin articleHtml { + @include articleDefaultFont; color: $font-pagetitle-color; h1 { @include articleXXLargeFont; @@ -142,7 +143,9 @@ font-size: $font-questiontitle-size; line-height: multiply(1.5, $font-questiontitle-size); - box-shadow: $shadow-small, 0 0 0 0px $primary; + box-shadow: + $shadow-small, + 0 0 0 0px $primary; transition: box-shadow $transition-duration; &:hover { @@ -150,7 +153,9 @@ } &:focus { - box-shadow: $shadow-small-reset, 0 0 0 2px $primary; + box-shadow: + $shadow-small-reset, + 0 0 0 2px $primary; } span {