import { defineComponent } from "vue";
import { expect, test } from "vite-plus/test";
import { render } from "@vue-tui/testing";
import { Box, Text } from "@vue-tui/runtime";
test("display flex", async () => {
const { lastFrame } = await render(
defineComponent(() => () => (
X
)),
{ columns: 100 },
);
expect(lastFrame({ trimLines: true })).toBe("X");
});
test("display none", async () => {
const { lastFrame } = await render(
defineComponent(() => () => (
Kitty!
Doggo
)),
{ columns: 100 },
);
expect(lastFrame({ trimLines: true })).toBe("Doggo");
});
// Skipped: display flex - concurrent
// Skipped: display none - concurrent
test("display none after visible sibling does not corrupt output", async () => {
const { lastFrame } = await render(
defineComponent(() => () => (
AAA
BBBBB
ZZ
)),
{ columns: 100 },
);
expect(lastFrame({ trimLines: true })).toBe("AAAZZ");
});
test("display none multi-line text adds no extra rows", async () => {
const { lastFrame } = await render(
defineComponent(() => () => (
top
{"h1\nh2\nh3"}
bottom
)),
{ columns: 100 },
);
expect(lastFrame({ trimLines: true })).toBe("top\nbottom");
});
test("display none box does not paint its border", async () => {
const { lastFrame } = await render(
defineComponent(() => () => (
AAA
X
ZZ
)),
{ columns: 100 },
);
expect(lastFrame({ trimLines: true })).toBe("AAAZZ");
});