Files
vue-tui/packages/runtime-tests/integration/quickstart.test.tsx
T

23 lines
653 B
TypeScript
Raw Normal View History

import { defineComponent, shallowRef } from "vue";
2026-05-24 18:13:53 +08:00
import { expect, test } from "vite-plus/test";
import { render } from "@vue-tui/testing";
import { Box, Text, useInput } from "@vue-tui/runtime";
test("README quickstart code runs to a Count: 0 frame", async () => {
const Counter = defineComponent(() => {
const count = shallowRef(0);
2026-05-24 18:13:53 +08:00
useInput((input) => {
if (input === "+") count.value++;
if (input === "-") count.value--;
});
return () => (
<Box>
<Text>Count: {count.value}</Text>
</Box>
);
});
const { lastFrame } = await render(Counter);
expect(lastFrame()).toContain("Count: 0");
});