feat(date-picker): support configurable week starts
This commit is contained in:
@@ -86,6 +86,39 @@ describe("DatePicker", () => {
|
||||
expect(screen.getByText("April 2028")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("defaults to a monday-first calendar grid", () => {
|
||||
render(
|
||||
<DatePicker
|
||||
aria-label="Monday-first date"
|
||||
defaultMonth={new Date(2026, 2, 1)}
|
||||
defaultOpen
|
||||
locale="en-US"
|
||||
/>
|
||||
);
|
||||
|
||||
const firstDay = within(screen.getByRole("grid")).getAllByRole("gridcell")[0];
|
||||
|
||||
expect(firstDay).toHaveAccessibleName("Feb 23, 2026");
|
||||
expect(screen.getByText("Mon")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("supports sunday-first calendar grids when requested", () => {
|
||||
render(
|
||||
<DatePicker
|
||||
aria-label="Sunday-first date"
|
||||
defaultMonth={new Date(2026, 2, 1)}
|
||||
defaultOpen
|
||||
locale="en-US"
|
||||
weekStartsOn="sunday"
|
||||
/>
|
||||
);
|
||||
|
||||
const firstDay = within(screen.getByRole("grid")).getAllByRole("gridcell")[0];
|
||||
|
||||
expect(firstDay).toHaveAccessibleName("Mar 1, 2026");
|
||||
expect(screen.getByText("Sun")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("respects min and max dates", async () => {
|
||||
render(
|
||||
<DatePicker
|
||||
|
||||
Reference in New Issue
Block a user