Skip to content

Commit fd4c02e

Browse files
committed
Add test for change
1 parent dd83bdd commit fd4c02e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/calendar_test.test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,37 @@ describe("Calendar", () => {
18821882
});
18831883
});
18841884

1885+
it("should add the aria-label correctly to day names", () => {
1886+
const expectedAriaLabels = [
1887+
"Sunday",
1888+
"Monday",
1889+
"Tuesday",
1890+
"Wednesday",
1891+
"Thursday",
1892+
"Friday",
1893+
"Saturday",
1894+
];
1895+
1896+
const { container } = render(
1897+
<Calendar
1898+
dateFormat={DATE_FORMAT}
1899+
onSelect={() => {}}
1900+
onClickOutside={() => {}}
1901+
/>,
1902+
);
1903+
1904+
const header = container.querySelector(".react-datepicker__header");
1905+
const dayNameElements = header.querySelectorAll(
1906+
".react-datepicker__day-name",
1907+
);
1908+
1909+
dayNameElements.forEach((element, index) => {
1910+
expect(element.getAttribute("aria-label")).toBe(
1911+
expectedAriaLabels[index],
1912+
);
1913+
});
1914+
});
1915+
18851916
it("should have a next-button with the provided aria-label for year", () => {
18861917
const ariaLabel = "A label in my native language for next year";
18871918
const { container } = render(

0 commit comments

Comments
 (0)