From fc36fb0959f1a82158381350ca2dd383d0f48e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bel=C3=A9n=20Albeza?= Date: Fri, 15 May 2026 12:04:51 +0200 Subject: [PATCH] :bug: Fix text editor being hidden to Playwright when empty text (#9682) --- frontend/playwright/ui/pages/WorkspacePage.js | 1 + .../playwright/ui/specs/text-editor-v2.spec.js | 16 ++++++++++++++++ .../main/ui/workspace/shapes/text/v2_editor.cljs | 4 ++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/frontend/playwright/ui/pages/WorkspacePage.js b/frontend/playwright/ui/pages/WorkspacePage.js index ec963f718a..e8e3a062b6 100644 --- a/frontend/playwright/ui/pages/WorkspacePage.js +++ b/frontend/playwright/ui/pages/WorkspacePage.js @@ -172,6 +172,7 @@ export class WorkspacePage extends BaseWebSocketPage { this.toolbarOptions = page.getByTestId("toolbar-options"); this.rectShapeButton = page.getByRole("button", { name: "Rectangle (R)" }); this.ellipseShapeButton = page.getByRole("button", { name: "Ellipse (E)" }); + this.textShapeButton = page.getByRole("button", { name: "Text (T)" }); this.moveButton = page.getByRole("button", { name: "Move (V)" }); this.boardButton = page.getByRole("button", { name: "Board (B)" }); this.toggleToolbarButton = page.getByRole("button", { diff --git a/frontend/playwright/ui/specs/text-editor-v2.spec.js b/frontend/playwright/ui/specs/text-editor-v2.spec.js index c12fef1bba..25676c45e1 100644 --- a/frontend/playwright/ui/specs/text-editor-v2.spec.js +++ b/frontend/playwright/ui/specs/text-editor-v2.spec.js @@ -315,3 +315,19 @@ test("BUG 11552 - Apply styles to the current caret", async ({ page }) => { await expect(fontSizeInput).toHaveValue(""); await expect(fontSizeInput).toHaveAttribute("placeholder", "Mixed"); }); + +// This is to prevent QA tests from failing due to playwright +// considering 0-width text boxes as invisible +test("BUG 14098 - Fix text editor having 0 width or height", async ({ page }) => { + const workspace = new WasmWorkspacePage(page); + + await workspace.setupEmptyFile(); + await workspace.mockRPC("update-file?id=*", "text-editor/update-file.json"); + await workspace.goToWorkspace(); + + await workspace.textShapeButton.click(); + await workspace.clickAt(200, 200); + + const textEditor = workspace.page.locator(`div[class*="viewport"]`).first().getByRole('textbox').first(); + await expect(textEditor).toBeVisible(); +}); diff --git a/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs b/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs index 779e7097aa..a92b0bf07b 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs @@ -423,8 +423,8 @@ (obj/merge! #js {"--editor-container-width" "auto" "--editor-container-height" "auto" - "--editor-container-min-width" (dm/str selrect-width "px") - "--editor-container-min-height" (dm/str selrect-height "px") + "--editor-container-min-width" (dm/str (max 1 selrect-width) "px") + "--editor-container-min-height" (dm/str (max 1 selrect-height) "px") "--fallback-families" (if (seq fallback-families) (dm/str (str/join ", " fallback-families)) "sourcesanspro") :display "flex"})