mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
Notification balloons reserve space for Dismiss in the title row. The body and action rows extend underneath it, giving paths and action labels more room to wrap in narrow windows. The cards use the standard UI text size and spacing.
35 lines
1.7 KiB
TypeScript
35 lines
1.7 KiB
TypeScript
import { expect, test } from "./fixtures";
|
|
|
|
test("fits notification body and actions below the dismiss button in a narrow window", async ({ workbench: page }) => {
|
|
await page.setViewportSize({ width: 420, height: 540 });
|
|
const title = "Validation failed for the catalog service";
|
|
const body = "The build stopped while checking the catalog response type.";
|
|
const action = "recheckCatalogServiceResponsePayloadAfterRegeneratingTypesForDevelopment";
|
|
await page.evaluate(
|
|
async ({ title, body, action }) => {
|
|
const servicePath = "/src/workbench/contributions.ts";
|
|
const { notifications } = await import(/* @vite-ignore */ servicePath);
|
|
notifications().notify({
|
|
level: "error",
|
|
title,
|
|
body,
|
|
actions: [{ label: action, run: () => document.body.setAttribute("data-validation-retried", "true") }],
|
|
});
|
|
},
|
|
{ title, body, action },
|
|
);
|
|
|
|
const balloon = page.getByRole("alert").filter({ hasText: title });
|
|
const message = balloon.getByText(body, { exact: true });
|
|
const dismiss = balloon.getByRole("button", { name: "Dismiss", exact: true });
|
|
const retry = balloon.getByRole("button", { name: action, exact: true });
|
|
await expect(balloon).toBeInViewport({ ratio: 1 });
|
|
const [messageBox, dismissBox] = await Promise.all([message.boundingBox(), dismiss.boundingBox()]);
|
|
expect(messageBox!.y).toBeGreaterThanOrEqual(dismissBox!.y + dismissBox!.height);
|
|
expect(messageBox!.x + messageBox!.width).toBeGreaterThanOrEqual(dismissBox!.x + dismissBox!.width - 1);
|
|
expect(await retry.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
|
await retry.click();
|
|
await expect(page.locator("body")).toHaveAttribute("data-validation-retried", "true");
|
|
await expect(balloon).toBeHidden();
|
|
});
|