mirror of
https://github.com/penpot/penpot.git
synced 2026-07-22 05:57:56 +00:00
🐛 Fix size badge shows "x" instead of dimensions when creating a path (#10550)
This commit is contained in:
parent
618ec57b6f
commit
e5d3ea14d1
@ -158,6 +158,35 @@ test("Selection size badge shows unrotated dimensions for rotated single selecti
|
||||
await expect(badgeText).toHaveText("126 x 134");
|
||||
});
|
||||
|
||||
test("Selection size badge shows dimensions for path shapes", async ({ page }) => {
|
||||
const workspacePage = new WasmWorkspacePage(page);
|
||||
await workspacePage.setupEmptyFile();
|
||||
await workspacePage.mockRPC(
|
||||
"update-file?id=*",
|
||||
"workspace/update-file-empty.json",
|
||||
);
|
||||
|
||||
await workspacePage.goToWorkspace();
|
||||
|
||||
// Workaround: hover viewport first to avoid nil mouse position crash
|
||||
await workspacePage.viewport.hover();
|
||||
|
||||
// Draw a path
|
||||
await workspacePage.pathButton.click();
|
||||
await workspacePage.clickAt(779, 163);
|
||||
await workspacePage.clickAt(951, 258);
|
||||
|
||||
// Finish drawing (commits path, path enters edition mode)
|
||||
await page.keyboard.press("Escape");
|
||||
|
||||
// Exit edition mode (path stays selected, badge becomes visible)
|
||||
await page.keyboard.press("Escape");
|
||||
|
||||
const badgeText = page.locator(".selection-size-badge text");
|
||||
await expect(badgeText).toBeVisible();
|
||||
await expect(badgeText).toHaveText(/\d+\.?\d* x \d+\.?\d*/);
|
||||
});
|
||||
|
||||
test("User makes a group", async ({ page }) => {
|
||||
const workspacePage = new WasmWorkspacePage(page);
|
||||
await workspacePage.setupEmptyFile();
|
||||
|
||||
@ -232,10 +232,12 @@
|
||||
;; For single shapes we show the original dimensions,
|
||||
;; for multiple shapes show the bounding box
|
||||
shape-width (if single-shape
|
||||
(dm/get-prop single-shape :width)
|
||||
(or (dm/get-prop single-shape :width)
|
||||
(:width selrect))
|
||||
(:width selrect))
|
||||
shape-height (if single-shape
|
||||
(dm/get-prop single-shape :height)
|
||||
(or (dm/get-prop single-shape :height)
|
||||
(:height selrect))
|
||||
(:height selrect))
|
||||
|
||||
text (dm/str (fmt/format-number shape-width) " x " (fmt/format-number shape-height))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user