fix: repair cross-package hook import, aria-label forwarding, and AU date format - #152
Open
stooit wants to merge 1 commit into
Open
fix: repair cross-package hook import, aria-label forwarding, and AU date format#152stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
… format - api.ts: import useDebounce instead of the removed useThrottle after the package rename; keep the useSearchDebounce alias the test asserts on - Button: forward aria-label and add an icon-only fallback label with a dev-only warning (WCAG 2.2 SC 4.1.2) - formatDate: strip the day's leading zero for the en-AU locale via Intl formatToParts (1/03/2024, not 01/03/2024) - tsconfig: add bun-types to the types array so bun:test resolves Fixes all 5 failing tests; tsc --noEmit is clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing tests and type errors in the monorepo. Before: 8 pass / 5 fail and 5
tscerrors. After: 13 pass / 0 fail andtsc --noEmitis clean (exit 0).Four source files changed; no test files modified and no dependencies added (per task constraints).
Fixes
apps/web/src/lib/api.ts— theuseThrottleimport no longer existed in@e2e/utilsafter the hook was renamed touseDebounce. Updated the import touseDebounceand collapsed the duplicate@e2e/utilsimports. TheuseSearchDebouncealias export (whichapi.test.tsasserts on) is preserved.useThrottlewas only ever a name — the underlying hook was always a trailing-edge debounce — so there is no behavioural regression.packages/ui/src/components/Button/Button.tsx—aria-labelwas not forwarded to the underlying<button>. It is now applied, with a fallback label for icon-only buttons that lack an explicit label plus a dev-onlyconsole.warn(WCAG 2.2 SC 4.1.2). Text buttons receivearia-label={undefined}, so no spurious attribute is rendered.packages/utils/src/format/date.ts—formatDateproduced01/03/2024; the test requires the day without a leading zero (1/03/2024). Rewrote usingIntl.DateTimeFormat().formatToPartsto strip the day's leading zero while keeping theen-AUDD/MM/YYYY shape.formatDateTimeis byte-identical (untouched).tsconfig.json— addedbun-typesto thetypesarray soimport ... from "bun:test"in the test files resolves (cleared allTS2307errors).bun-typeswas already a devDependency.Verification
No files under
*/test/were modified; nopackage.json/lockfile changes.Assumptions
formatDate(1/03/2024) because it satisfies the test with a 4-digit year.dateStyle: "short"would give1/3/24(2-digit year) — avoided to prevent a potential regression against the year format.aria-labelfor unlabelled icon-only buttons because the test assertsaria-labelisnot.toBeNull(); the test could not be modified.Follow-ups (out of scope — not required by any test)
Raised by review, deliberately deferred to keep this change to "fix only what the tests require":
formatDateday/month zero-padding is a D/MM hybrid and inconsistent withformatDateTime; and neither function pins atimeZone, so output is host-zone dependent (pre-existing)."Button"fallback label satisfies the test but conveys no purpose; the warning keys off theiconOnlyflag rather than actual absence of text, and fires in the render body. Worth revisiting alongside the test assertion.DataTable.tsxstill carries aBUG:docblock about a stale closure; its 3 tests pass and the claim appears inaccurate.bun-typesis pinned to"latest"— worth pinning for reproducible builds.