test(ui): pin the Calendar clock so range specs stop depending on today - #16
Open
ArdaDDemir wants to merge 1 commit into
Open
test(ui): pin the Calendar clock so range specs stop depending on today#16ArdaDDemir wants to merge 1 commit into
ArdaDDemir wants to merge 1 commit into
Conversation
The range specs clicked hardcoded July 2026 cells, but in range mode the opening view is derived from `defaultRangeValue`, and an empty range falls back to today. Those cells only render while the clock sits in July 2026, so the suite went red on 1 August with no source change. user-event no-ops on a null target instead of throwing, so the missing cells also made `expect(onRangeValueChange).not.toHaveBeenCalled()` pass vacuously and pushed the failure one assertion further down. - freeze the clock at 2026-07-15 for this file - route every click through `dayCell()`, which fails when a cell is absent - add coverage for end-first range ordering and the default month view Verified green with the real clock frozen to January, April, August and December. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What
Calendar (smoke) > supports range start then endhas been failing since 1 August with no source change. This pins the clock for the spec file and closes the hole that let the failure hide.Why it broke
In range mode the opening view is derived from
rangeValue/defaultRangeValue(calendar.tsx:231-235); an empty range falls back to today. The spec passeddefaultValue="2026-07-01", which range mode deliberately ignores, so the panel opened on the current month and the hardcoded2026-07-10/2026-07-12cells were never rendered.That made it a time bomb: green through July 2026, red every other month. Confirmed by running the unmodified spec against a frozen clock — July passes, January / April / October / December fail.
A second issue kept it quiet: user-event no-ops on a null target instead of throwing, so
expect(onRangeValueChange).not.toHaveBeenCalled()passed vacuously and the failure surfaced one assertion later, pointing at the wrong line.Verified in a browser against the running docs gallery: with an empty range the panel opens on today's month, while the pinned Range showcase opens on July 2026 and highlights 10-14 correctly. Clicking two days produces the expected
data-range-start/data-range-end. The component behaves correctly — only the spec was wrong.Changes
calendar.test.tsx, with a comment explaining why the literal dates need itdayCell(), which fails loudly when a cell is absentVerification
npm test— 45 files, 79/79 pass (was 76/77)npm run typecheck— cleannpm run lint— 6 pre-existing problems inapps/web, identical onmainat ccf4ad3, untouched hereTest-only change; no source files modified.
🤖 Generated with Claude Code