1550ab9ad1
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
21 lines
656 B
TypeScript
21 lines
656 B
TypeScript
import { defineComponent } from "vue";
|
|
import { expect, test } from "vite-plus/test";
|
|
import { render } from "@vue-tui/testing";
|
|
import { Box, Text } from "@vue-tui/runtime";
|
|
import stripAnsi from "strip-ansi";
|
|
|
|
test("multi-line truncate text keeps its line count (height)", async () => {
|
|
const { lastFrame } = await render(
|
|
defineComponent(() => () => (
|
|
<Box width={24}>
|
|
<Text wrap="truncate">{"x\nyhello"}</Text>
|
|
</Box>
|
|
)),
|
|
{ columns: 100 },
|
|
);
|
|
const lines = stripAnsi(lastFrame({ trimLines: true })!).split("\n");
|
|
expect(lines.length).toBe(2);
|
|
expect(lines[0]).toBe("x");
|
|
expect(lines[1]).toBe("yhello");
|
|
});
|