5e54e5742d
AGENTS.md requires shallowRef by default. All test state uses reassignment (not mutation), so shallowRef is correct. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
23 lines
653 B
TypeScript
23 lines
653 B
TypeScript
import { defineComponent, shallowRef } from "vue";
|
|
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);
|
|
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");
|
|
});
|