feat(runtime-tests): integration test suite

21 test files covering components, composables, focus, lifecycle,
and scheduler through the public render() API.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-05-24 18:13:53 +08:00
parent 71c517b79f
commit a7f7d9957d
24 changed files with 997 additions and 0 deletions
@@ -0,0 +1,33 @@
import { defineComponent, nextTick, ref } from "vue";
import { expect, test } from "vite-plus/test";
import { render } from "@vue-tui/testing";
import { Text } from "@vue-tui/runtime";
test("setup() throw rejects render()", async () => {
const Boom = defineComponent(() => {
throw new Error("setup boom");
});
await expect(render(Boom)).rejects.toThrow("setup boom");
});
test("render-time throw does not prevent unmount", async () => {
const trigger = ref(false);
const App = defineComponent(() => {
return () => {
if (trigger.value) throw new Error("render boom");
return <Text>ok</Text>;
};
});
const { lastFrame, unmount } = await render(App);
expect(lastFrame()).toContain("ok");
trigger.value = true;
try {
await nextTick();
} catch {
// swallow the render error
}
expect(() => unmount()).not.toThrow();
});