39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import "@mantine/core/styles.css";
|
|
|
|
import "../styles.css";
|
|
|
|
import { MantineProvider } from "@mantine/core";
|
|
// eslint-disable-next-line testing-library/no-manual-cleanup -- Vitest globals are disabled, so RTL cannot register its automatic afterEach cleanup.
|
|
import { cleanup, render, screen } from "@testing-library/react";
|
|
import { afterEach, expect, it } from "vitest";
|
|
|
|
import { cssVariablesResolver, theme } from "../theme";
|
|
import { EntryCard } from "./EntryCard";
|
|
|
|
afterEach(cleanup);
|
|
|
|
it("shows the full wrapped title without horizontal overflow", () => {
|
|
const title = "Дивидендная выплата с очень длинным описанием, которое должно переноситься и оставаться доступным полностью";
|
|
|
|
render(
|
|
<MantineProvider cssVariablesResolver={cssVariablesResolver} theme={theme}>
|
|
<EntryCard
|
|
initial="Д"
|
|
metadata="29.09.2026"
|
|
title={title}
|
|
tone="positive"
|
|
value="123 456 789,90 ₽"
|
|
valueLabel="Дивиденды"
|
|
wrap
|
|
/>
|
|
</MantineProvider>,
|
|
);
|
|
|
|
const description = screen.getByText(title);
|
|
expect(description.clientHeight).toBeGreaterThan(0);
|
|
expect(description.scrollHeight)
|
|
.toBeLessThanOrEqual(description.clientHeight);
|
|
expect(document.documentElement.scrollWidth)
|
|
.toBeLessThanOrEqual(window.innerWidth);
|
|
});
|