34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
// @vitest-environment jsdom
|
|
import "@testing-library/jest-dom/vitest";
|
|
import React from "react";
|
|
import { render } from "@testing-library/react";
|
|
import { describe, expect, it, vi } from "vitest";
|
|
|
|
import { P9_OPERATIONS_INTERIM_VISUAL_SCREENS, P9OperationsInterimVisualFixture } from "./p9-operations-interim.visual-fixture";
|
|
|
|
vi.mock("react-i18next", () => ({
|
|
useTranslation: () => ({
|
|
t: (key: string, values?: Record<string, unknown>) => (values ? `${key}:${Object.values(values).join("/")}` : key),
|
|
i18n: { language: "de" },
|
|
}),
|
|
}));
|
|
|
|
describe("R-P9 operations interim visual baseline", () => {
|
|
it("renders the plantafel, acceptance list, and sub-areas surfaces from ~/ui", () => {
|
|
render(
|
|
<main data-ui-id="ui.projects.operations.interim.visualBaseline">
|
|
{P9_OPERATIONS_INTERIM_VISUAL_SCREENS.map((screen) => (
|
|
<P9OperationsInterimVisualFixture key={screen} screen={screen} />
|
|
))}
|
|
</main>,
|
|
);
|
|
|
|
expect(document.querySelectorAll("[data-ui-id='ui.projects.plantafel']")).toHaveLength(1);
|
|
expect(document.querySelectorAll("[data-ui-id='ui.projects.acceptance.list']")).toHaveLength(1);
|
|
expect(document.querySelectorAll("[data-ui-id='ui.projects.operations']")).toHaveLength(1);
|
|
|
|
const stableMarkup = document.body.innerHTML.replace(/<svg\b[^>]*>[\s\S]*?<\/svg>/gu, '<svg data-visual-icon="true"></svg>');
|
|
expect(stableMarkup).toMatchSnapshot();
|
|
});
|
|
});
|