From d46f3ac1b650c6480bb7645844c2714d36417608 Mon Sep 17 00:00:00 2001 From: Aleksey Novikov Date: Mon, 3 Feb 2025 14:51:18 +0300 Subject: [PATCH] #6487 Missing tooltips on page, panel, and question expand/collapse Fixes #6487 --- functionalTests/designer/question-wrapper.ts | 24 +++++++++++++++++++ .../components/action-container-view-model.ts | 1 + .../src/localization/english.ts | 2 ++ 3 files changed, 27 insertions(+) diff --git a/functionalTests/designer/question-wrapper.ts b/functionalTests/designer/question-wrapper.ts index 4c38f10737..c3e1200621 100644 --- a/functionalTests/designer/question-wrapper.ts +++ b/functionalTests/designer/question-wrapper.ts @@ -420,6 +420,30 @@ test("Question adorner - collapse button in differen modes", async (t) => { await ClientFunction(() => { window["creator"].expandCollapseButtonVisibility = "never"; })(); }); +test("Question and page collapse button title", async (t) => { + await ClientFunction(() => { window["creator"].expandCollapseButtonVisibility = "always"; })(); + await t.resizeWindow(1920, 1080); + const json = { + elements: [ + { + type: "text", + name: "question1" + } + ] + }; + await setJSON(json); + await t.hover(getToolboxItemByText("Single-Line Input")); + const qCollapseButton = Selector(".svc-question__content #collapse button"); + await t.expect(qCollapseButton.getAttribute("title")).eql("Collapse"); + await t.click(qCollapseButton); + await t.expect(qCollapseButton.getAttribute("title")).eql("Expand"); + + const pCollapseButton = Selector(".svc-page__content #collapse button"); + await t.expect(pCollapseButton.getAttribute("title")).eql("Collapse"); + await t.click(pCollapseButton); + await t.expect(pCollapseButton.getAttribute("title")).eql("Expand"); +}); + test("Question adorner - do not render content when initially collapsed", async (t) => { const json = { elements: [ diff --git a/packages/survey-creator-core/src/components/action-container-view-model.ts b/packages/survey-creator-core/src/components/action-container-view-model.ts index e0edaf2d4c..624af41a20 100644 --- a/packages/survey-creator-core/src/components/action-container-view-model.ts +++ b/packages/survey-creator-core/src/components/action-container-view-model.ts @@ -406,6 +406,7 @@ export class SurveyElementAdornerBase e return { id: "collapse", css: "sv-action-bar-item--collapse", + locTooltipName: new ComputedUpdater(() => this.collapsed ? "ed.expandTooltip" : "ed.collapseTooltip") as any, iconName: new ComputedUpdater(() => this.collapsed ? expandIcon : collapseIcon) as any, iconSize: "auto", action: () => { diff --git a/packages/survey-creator-core/src/localization/english.ts b/packages/survey-creator-core/src/localization/english.ts index c6b546c58d..86b2929ad1 100644 --- a/packages/survey-creator-core/src/localization/english.ts +++ b/packages/survey-creator-core/src/localization/english.ts @@ -109,6 +109,8 @@ export var enStrings = { redo: "Redo", undoTooltip: "Undo last change", redoTooltip: "Redo the change", + expandTooltip: "Expand", + collapseTooltip: "Collapse", expandAllTooltip: "Expand All", collapseAllTooltip: "Collapse All", zoomInTooltip: "Zoom In",