f4e35974c6
Deploy staging to test server / deploy (push) Failing after 14m49s
This reverts commita55c69115d, reversing changes made to02c9c9f3d6.
37 lines
1.7 KiB
TypeScript
37 lines
1.7 KiB
TypeScript
import assert from "node:assert/strict"
|
|
import { existsSync, readFileSync } from "node:fs"
|
|
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)
|
|
assert.equal(existsSync(new URL("../src/components/ui/popover.tsx", import.meta.url)), true)
|
|
assert.match(packageJson, /"react-day-picker"/)
|
|
})
|
|
|
|
test("replaces the native birth date input with the shadcn date picker", () => {
|
|
assert.equal(existsSync(pickerUrl), true)
|
|
assert.doesNotMatch(intake, /type="date"/)
|
|
assert.match(intake, /<BirthDatePicker/)
|
|
const picker = readFileSync(pickerUrl, "utf8")
|
|
assert.match(picker, /<PopoverTrigger/)
|
|
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 month and year dropdowns clickable above calendar navigation", () => {
|
|
const calendar = readFileSync(calendarUrl, "utf8")
|
|
|
|
assert.match(calendar, /pointer-events-none absolute inset-x-0 top-0/)
|
|
assert.match(calendar, /pointer-events-auto size-\(--cell-size\)/)
|
|
})
|