diff --git a/src/test/month_test.test.tsx b/src/test/month_test.test.tsx index a2036e188..a5b08e5f8 100644 --- a/src/test/month_test.test.tsx +++ b/src/test/month_test.test.tsx @@ -1114,6 +1114,70 @@ describe("Month", () => { expect(onDayMouseEnterSpy).not.toHaveBeenCalled(); }); + it("should return disabled class if specified excludeDate", () => { + const onDayClickSpy = jest.fn(); + const onDayMouseEnterSpy = jest.fn(); + const { container } = render( + , + ); + // exclude quarter index + const quarterTexts = container.querySelectorAll( + ".react-datepicker__quarter-text", + ); + + [0, 2].forEach((i) => { + const quarter = quarterTexts[i]!; + expect( + quarter.classList.contains("react-datepicker__quarter-text--disabled"), + ).toBe(true); + fireEvent.click(quarter); + expect(onDayClickSpy).not.toHaveBeenCalled(); + fireEvent.mouseEnter(quarter); + expect(onDayMouseEnterSpy).not.toHaveBeenCalled(); + }); + }); + + it("should return disabled class if specified includeDate", () => { + const onDayClickSpy = jest.fn(); + const onDayMouseEnterSpy = jest.fn(); + const { container } = render( + , + ); + // include quarter index + const quarterTexts = container.querySelectorAll( + ".react-datepicker__quarter-text", + ); + + [1, 3].forEach((i) => { + const quarter = quarterTexts[i]!; + expect( + quarter.classList.contains("react-datepicker__quarter-text--disabled"), + ).toBe(true); + fireEvent.click(quarter); + expect(onDayClickSpy).not.toHaveBeenCalled(); + fireEvent.mouseEnter(quarter); + expect(onDayMouseEnterSpy).not.toHaveBeenCalled(); + }); + }); + describe("if quarter is selected", () => { let monthComponent: HTMLElement; let quarter: HTMLElement;