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>
31 lines
904 B
TypeScript
31 lines
904 B
TypeScript
import { defineComponent, nextTick, shallowRef } from "vue";
|
|
import { expect, test } from "vite-plus/test";
|
|
import { render } from "@vue-tui/testing";
|
|
import { Text, useFocus } from "@vue-tui/runtime";
|
|
|
|
test("swapping focusable components never disables raw mode", async () => {
|
|
const showA = shallowRef(true);
|
|
|
|
const Item = defineComponent(() => {
|
|
useFocus();
|
|
return () => <Text>x</Text>;
|
|
});
|
|
|
|
const Root = defineComponent(() => {
|
|
return () => (showA.value ? <Item key="a" /> : <Item key="b" />);
|
|
});
|
|
|
|
const { terminal, unmount } = await render(Root);
|
|
expect(terminal.rawMode.current).toBe(true);
|
|
const historyBefore = terminal.rawMode.history.length;
|
|
|
|
showA.value = false;
|
|
await nextTick();
|
|
|
|
expect(terminal.rawMode.current).toBe(true);
|
|
const swapHistory = terminal.rawMode.history.slice(historyBefore);
|
|
expect(swapHistory).not.toContain(false);
|
|
|
|
unmount();
|
|
});
|