🐛 Allow negative value on margins (#10353)

This commit is contained in:
Eva Marco 2026-06-22 13:12:30 +02:00 committed by GitHub
parent 5a82a38c9c
commit e495e0ac59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 63 additions and 7 deletions

View File

@ -78,3 +78,63 @@ test("BUG 14226: Numeric inputs in the design panel reject values with leading w
await widthInput.press("Enter");
await expect(widthInput).toHaveValue("100");
});
test("BUG 10001: Negative margins are allowed on the numeric input", async ({
page,
}) => {
const workspacePage = new WasmWorkspacePage(page);
await workspacePage.setupEmptyFile(page);
await workspacePage.mockRPC(
/get\-file\?/,
"workspace/get-file-copy-paste.json",
);
await workspacePage.mockRPC(
"get-file-fragment?file-id=*&fragment-id=*",
"workspace/get-file-copy-paste-fragment.json",
);
await workspacePage.goToWorkspace({
fileId: "870f9f10-87b5-8137-8005-934804124660",
pageId: "870f9f10-87b5-8137-8005-934804124661",
});
// Select first shape
await page.getByTestId("layer-item").getByRole("button").first().click();
await workspacePage.layers.getByTestId("layer-row").nth(5).click();
const addLayout = workspacePage.rightSidebar.getByRole("button", {
name: "Add layout",
});
await addLayout.click();
const flexLayout = workspacePage.rightSidebar.getByRole("button", {
name: "Flex layout",
});
await flexLayout.click();
const layoutSection = workspacePage.rightSidebar.getByRole("region", {
name: "Layout container section",
});
await expect(layoutSection).toBeVisible();
await workspacePage.layers.getByTestId("layer-row").nth(6).click();
await page.waitForTimeout(500);
const layoutItemSection = workspacePage.rightSidebar.getByRole("region", {
name: "Layout item section",
});
await expect(layoutItemSection).toBeVisible();
const verticalMarginInput = layoutItemSection.getByRole("textbox", {
name: "Vertical margin",
});
await expect(verticalMarginInput).toBeVisible();
await verticalMarginInput.fill("-10");
await verticalMarginInput.press("Enter");
await expect(verticalMarginInput).toHaveValue("-10");
});

View File

@ -1280,7 +1280,9 @@
:on-click on-add-layout}
(tr "labels.grid-layout")]]])]
[:div {:class (stl/css :element-set) :data-testid "inspect-layout"}
[:section {:class (stl/css :element-set)
:aria-label "Layout container section"
:data-testid "inspect-layout"}
[:div {:class (stl/css :element-title)}
[:> title-bar*
{:collapsable has-layout?

View File

@ -145,7 +145,6 @@
:on-focus on-focus-m1
:placeholder m1-placeholder
:icon i/margin-top-bottom
:min 0
:attr :m1
:default nil
:input-type :vertical-margin
@ -176,7 +175,6 @@
:placeholder m2-placeholder
:icon i/margin-left-right
:class (stl/css :horizontal-margin-wrapper)
:min 0
:attr :m2
:align :right
:default nil
@ -271,7 +269,6 @@
:on-focus on-focus-m1
:icon i/margin-top
:class (stl/css :top-margin-wrapper)
:min 0
:default nil
:attr :m1
:input-type :vertical-margin
@ -300,7 +297,6 @@
:on-focus on-focus-m2
:icon i/margin-right
:class (stl/css :right-margin-wrapper)
:min 0
:default nil
:attr :m2
:align :right
@ -331,7 +327,6 @@
:on-focus on-focus-m3
:icon i/margin-bottom
:class (stl/css :bottom-margin-wrapper)
:min 0
:attr :m3
:default nil
:align :right
@ -362,7 +357,6 @@
:on-focus on-focus-m4
:icon i/margin-left
:class (stl/css :left-margin-wrapper)
:min 0
:default nil
:attr :m4
:property "Left margin"