Skip to content

Commit

Permalink
Add test for change
Browse files Browse the repository at this point in the history
  • Loading branch information
plahteenlahti committed Apr 15, 2024
1 parent dd83bdd commit fd4c02e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/calendar_test.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1882,6 +1882,37 @@ describe("Calendar", () => {
});
});

it("should add the aria-label correctly to day names", () => {
const expectedAriaLabels = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
];

const { container } = render(
<Calendar
dateFormat={DATE_FORMAT}
onSelect={() => {}}
onClickOutside={() => {}}
/>,
);

const header = container.querySelector(".react-datepicker__header");
const dayNameElements = header.querySelectorAll(
".react-datepicker__day-name",
);

dayNameElements.forEach((element, index) => {
expect(element.getAttribute("aria-label")).toBe(
expectedAriaLabels[index],
);
});
});

it("should have a next-button with the provided aria-label for year", () => {
const ariaLabel = "A label in my native language for next year";
const { container } = render(
Expand Down

0 comments on commit fd4c02e

Please sign in to comment.