mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-12-03 21:23:54 +08:00
With the category Combobox of the New task sheet open, an overlay click closed the whole sheet: isRadixOverlayOpenNow did not match the Base UI popup, whose open state is data-open, not data-state. Add [data-slot='combobox-content'][data-open] to the selector. Add web/src/lib/utils.test.mjs, run by test:reducers: a DOM-free test of preventDismissUnlessOverlayClick with a stub document, covering Select, popper content, Combobox, menu triggers, the open sheet/dialog trigger and an expanded Collapsible. The alias loader now adds the JSON import attribute so tests can import modules that depend on @/i18n. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
1.2 KiB
JavaScript
29 lines
1.2 KiB
JavaScript
// Node module hooks for running TypeScript tests with `node --test`: resolves the
|
|
// "@/..." path alias (tsconfig "paths") to src/, adding the ".ts" extension that the
|
|
// bundler normally infers. Registered by scripts/register-alias.mjs.
|
|
|
|
const SRC = new URL("../src/", import.meta.url);
|
|
|
|
export async function resolve(specifier, context, nextResolve) {
|
|
if (specifier.startsWith("@/")) {
|
|
const base = new URL(specifier.slice(2), SRC).href;
|
|
for (const candidate of [base, `${base}.ts`, `${base}.tsx`, `${base}/index.ts`]) {
|
|
try {
|
|
return await nextResolve(candidate, context);
|
|
} catch {
|
|
// try the next candidate
|
|
}
|
|
}
|
|
}
|
|
return nextResolve(specifier, context);
|
|
}
|
|
|
|
// The bundler imports locale JSON (src/i18n) without `with { type: "json" }`; Node requires the
|
|
// attribute, so add it here. This lets tests import modules that depend on @/i18n (e.g. @/lib/utils).
|
|
export async function load(url, context, nextLoad) {
|
|
if (url.endsWith(".json") && context.importAttributes?.type !== "json") {
|
|
return nextLoad(url, { ...context, importAttributes: { ...context.importAttributes, type: "json" } });
|
|
}
|
|
return nextLoad(url, context);
|
|
}
|