mirror of
https://github.com/rommapp/romm.git
synced 2026-10-12 02:21:58 +00:00
simplify pass: - useInputModality gains pin(), which gates setModality so pinned modes ignore the listeners (and useGamepad) instead of a watcher undoing their writes; drops the manual data-input write and the HMR dispose - one INPUT_DEFAULT shared by initialGlobals and the decorator fallback - the Input Navigation stories share one render on meta Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
26 lines
944 B
TypeScript
26 lines
944 B
TypeScript
import type { StoryContext } from "@storybook/vue3-vite";
|
|
import { mount } from "@vue/test-utils";
|
|
import { expect, it } from "vitest";
|
|
import { defineComponent, nextTick, reactive } from "vue";
|
|
import { useInputModality } from "@/v2/composables/useInputModality";
|
|
import { withInputModality } from "../.storybook/withInputModality";
|
|
|
|
it("pins the toolbar's mode over live input and follows a toolbar change", async () => {
|
|
useInputModality().install();
|
|
const globals = reactive({ input: "key" });
|
|
const story = defineComponent({ render: () => null });
|
|
mount(
|
|
withInputModality(
|
|
story as unknown as Parameters<typeof withInputModality>[0],
|
|
{ globals } as unknown as StoryContext,
|
|
),
|
|
);
|
|
|
|
window.dispatchEvent(new Event("touchstart"));
|
|
expect(document.documentElement.dataset.input).toBe("key");
|
|
|
|
globals.input = "touch";
|
|
await nextTick();
|
|
expect(document.documentElement.dataset.input).toBe("touch");
|
|
});
|