Resolve merge conflicts with upstream - keep GitHub versions
This commit is contained in:
@@ -5,6 +5,7 @@ import test from "node:test"
|
||||
const packageJson = readFileSync(new URL("../package.json", import.meta.url), "utf8")
|
||||
const intake = readFileSync(new URL("../src/components/birth-time-intake.tsx", import.meta.url), "utf8")
|
||||
const pickerUrl = new URL("../src/components/birth-date-picker.tsx", import.meta.url)
|
||||
const calendarUrl = new URL("../src/components/ui/calendar.tsx", import.meta.url)
|
||||
|
||||
test("provides the shadcn calendar and popover primitives", () => {
|
||||
assert.equal(existsSync(new URL("../src/components/ui/calendar.tsx", import.meta.url)), true)
|
||||
@@ -21,25 +22,15 @@ test("replaces the native birth date input with the shadcn date picker", () => {
|
||||
assert.match(picker, /render=\{<Button/)
|
||||
assert.match(picker, /<Calendar/)
|
||||
assert.match(picker, /captionLayout="dropdown"/)
|
||||
assert.match(picker, /const defaultMonth = new Date\(1997, today\.getMonth\(\), 1\)/)
|
||||
assert.match(picker, /defaultMonth=\{selected \?\? defaultMonth\}/)
|
||||
assert.match(picker, /startMonth=\{new Date\(1900, 0\)\}/)
|
||||
assert.match(picker, /reverseYears/)
|
||||
})
|
||||
|
||||
test("keeps the shadcn date-of-birth dropdown navigation order", () => {
|
||||
// Given the shadcn Date of Birth composition
|
||||
const picker = readFileSync(pickerUrl, "utf8")
|
||||
test("keeps the month and year dropdowns clickable above calendar navigation", () => {
|
||||
const calendar = readFileSync(calendarUrl, "utf8")
|
||||
|
||||
// When dropdown captions are enabled
|
||||
// Then the picker must not move the full-width nav after the caption selects
|
||||
assert.doesNotMatch(picker, /navLayout="after"/)
|
||||
})
|
||||
|
||||
test("opens an empty birth date picker at 1997 instead of the current year", () => {
|
||||
// Given: a new user has not selected a birth date yet.
|
||||
const picker = readFileSync(pickerUrl, "utf8")
|
||||
|
||||
// When: the popover chooses its initial visible month.
|
||||
// Then: it starts in 1997 so common birth years are nearby.
|
||||
assert.match(picker, /const emptyDefaultMonth = new Date\(1997, 0, 1\)/)
|
||||
assert.match(picker, /defaultMonth=\{selected \?\? emptyDefaultMonth\}/)
|
||||
assert.match(calendar, /pointer-events-none absolute inset-x-0 top-0/)
|
||||
assert.match(calendar, /pointer-events-auto size-\(--cell-size\)/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user