mirror of
https://github.com/penpot/penpot.git
synced 2026-05-24 17:33:41 +00:00
81 lines
2.4 KiB
JavaScript
81 lines
2.4 KiB
JavaScript
import { test, expect } from "@playwright/test";
|
|
import { WasmWorkspacePage } from "../pages/WasmWorkspacePage";
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await WasmWorkspacePage.init(page);
|
|
await WasmWorkspacePage.mockConfigFlags(page, ["enable-feature-token-input"]);
|
|
});
|
|
|
|
test("BUG 14226: Numeric inputs in the design panel reject values with leading whitespace", 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(0).click();
|
|
|
|
// Check if measures section is visible
|
|
const measuresSection = workspacePage.rightSidebar.getByRole("region", {
|
|
name: "shape-measures-section",
|
|
});
|
|
await expect(measuresSection).toBeVisible();
|
|
|
|
// Width
|
|
const widthInput = measuresSection.getByRole("textbox", {
|
|
name: "Width",
|
|
exact: true,
|
|
});
|
|
await expect(widthInput).toHaveValue("360");
|
|
|
|
await widthInput.fill("100");
|
|
await widthInput.press("Enter");
|
|
await expect(widthInput).toHaveValue("100");
|
|
|
|
await widthInput.fill(" 100");
|
|
await widthInput.press("Enter");
|
|
await expect(widthInput).toHaveValue("100");
|
|
|
|
await widthInput.fill(" 100 ");
|
|
await widthInput.press("Enter");
|
|
await expect(widthInput).toHaveValue("100");
|
|
|
|
await widthInput.fill("100 ");
|
|
await widthInput.press("Enter");
|
|
await expect(widthInput).toHaveValue("100");
|
|
|
|
await widthInput.fill("98+2");
|
|
await widthInput.press("Enter");
|
|
await expect(widthInput).toHaveValue("100");
|
|
|
|
await widthInput.fill("98 + 2");
|
|
await widthInput.press("Enter");
|
|
await expect(widthInput).toHaveValue("100");
|
|
|
|
await widthInput.fill(" 98 + 2 ");
|
|
await widthInput.press("Enter");
|
|
await expect(widthInput).toHaveValue("100");
|
|
|
|
await widthInput.fill(" 98+2 ");
|
|
await widthInput.press("Enter");
|
|
await expect(widthInput).toHaveValue("100");
|
|
|
|
await widthInput.fill(" asdasdasdasd ");
|
|
await widthInput.press("Enter");
|
|
await expect(widthInput).toHaveValue("100");
|
|
});
|