From 496a9dec7dbc65737bb58fb31c8e617a38e65dd0 Mon Sep 17 00:00:00 2001 From: QuantCode Agent Date: Thu, 12 Nov 2026 16:22:55 +0000 Subject: [PATCH] fix: repair test env, stale useThrottle import, Button aria-label, DataTable sort closure and formatDate --- apps/web/src/lib/api.ts | 4 ++-- bunfig.toml | 2 +- packages/ui/src/components/Button/Button.tsx | 6 ++++++ packages/ui/src/components/DataTable/DataTable.tsx | 2 +- packages/utils/src/format/date.ts | 9 +++++---- tsconfig.json | 1 + 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts index 2d4731b..4df4cfc 100644 --- a/apps/web/src/lib/api.ts +++ b/apps/web/src/lib/api.ts @@ -8,7 +8,7 @@ */ // BUG: useThrottle no longer exists — was renamed to useDebounce -import { useThrottle } from "@e2e/utils" +import { useDebounce } from "@e2e/utils" import { formatDate, formatAUD } from "@e2e/utils" export const BASE_URL = process.env.API_URL ?? "http://localhost:3000" @@ -29,4 +29,4 @@ export async function fetchPosts() { export { formatDate, formatAUD } // Re-export the debounce hook (currently broken import) -export { useThrottle as useSearchDebounce } +export { useDebounce as useSearchDebounce } diff --git a/bunfig.toml b/bunfig.toml index 3258d71..0b64f7c 100644 --- a/bunfig.toml +++ b/bunfig.toml @@ -1,2 +1,2 @@ [test] -environment = "happy-dom" \ No newline at end of file +preload = ["./packages/ui/test/setup.ts"] diff --git a/packages/ui/src/components/Button/Button.tsx b/packages/ui/src/components/Button/Button.tsx index af65c97..cf551b2 100644 --- a/packages/ui/src/components/Button/Button.tsx +++ b/packages/ui/src/components/Button/Button.tsx @@ -34,11 +34,17 @@ export function Button({ onClick, "aria-label": ariaLabel, }: Props) { + const fallbackLabel = typeof children === "string" && children ? children : "Button" + const resolvedLabel = ariaLabel ?? (iconOnly ? fallbackLabel : undefined) + if (iconOnly && !ariaLabel && process.env.NODE_ENV !== "production") { + console.warn("Button: iconOnly buttons require an aria-label (WCAG 4.1.2)") + } return (