From 839646da948bdf95be69d998b9fe89e3f2f4b450 Mon Sep 17 00:00:00 2001 From: Martijn Russchen Date: Mon, 30 Oct 2023 10:40:05 +0100 Subject: [PATCH] Add Enzyme deprecation linter to avoid more usage of Enzyme Relates to https://github.com/Hacker0x01/react-datepicker/issues/4300 --- .eslintrc | 5 +- package.json | 1 + test/calendar_icon.test.js | 5 +- test/calendar_test.test.js | 23 +++++++++ test/datepicker_test.test.js | 51 ++++++++++++------- test/day_test.test.js | 21 +++++--- test/exclude_time_period_test.test.js | 1 + test/inject_times_test.test.js | 4 ++ test/month_dropdown_test.test.js | 2 + test/month_test.test.js | 68 +++++++++++++++++++++---- test/month_year_dropdown_test.test.js | 2 + test/multi_month_test.test.js | 1 + test/show_time_test.test.js | 5 +- test/time_format_test.test.js | 21 +++++--- test/time_input_test.test.js | 10 +++- test/week_number_test.test.js | 4 +- test/week_test.test.js | 14 +++-- test/year_dropdown_options_test.test.js | 9 ++++ test/year_dropdown_test.test.js | 1 + test/year_picker_test.test.js | 31 ++++++++--- yarn.lock | 32 ++++++++++++ 21 files changed, 251 insertions(+), 60 deletions(-) diff --git a/.eslintrc b/.eslintrc index d7e64e87a..7d9a7afef 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,7 +6,8 @@ "plugins": [ "react", - "unused-imports" + "unused-imports", + "enzyme-deprecation" ], "parserOptions": { @@ -20,6 +21,8 @@ "parser": "@babel/eslint-parser", "rules": { + "enzyme-deprecation/no-shallow": 2, + "enzyme-deprecation/no-mount": 2, "no-unused-vars": "off", "unused-imports/no-unused-imports": "error", "unused-imports/no-unused-vars": [ diff --git a/package.json b/package.json index 0a75d323c..3aa1a18b9 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "css-loader": "^6.8.1", "enzyme": "^3.11.0", "eslint": "^8.44.0", + "eslint-plugin-enzyme-deprecation": "^0.7.7", "eslint-plugin-import": "^2.27.5", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^6.1.0", diff --git a/test/calendar_icon.test.js b/test/calendar_icon.test.js index d38dea762..495c909fc 100644 --- a/test/calendar_icon.test.js +++ b/test/calendar_icon.test.js @@ -14,6 +14,7 @@ afterAll(() => { describe("CalendarIcon", () => { it("renders a custom SVG icon when provided", () => { const wrapper = mount( + // eslint-disable-line enzyme-deprecation/no-mount } />, ); expect( @@ -22,12 +23,12 @@ describe("CalendarIcon", () => { }); it("renders a FontAwesome icon when provided", () => { - const wrapper = mount(); + const wrapper = mount(); // eslint-disable-line enzyme-deprecation/no-mount expect(wrapper.find("i.fa-example-icon")).toHaveLength(1); }); it("does not render an icon when none is provided", () => { - const wrapper = mount(); + const wrapper = mount(); // eslint-disable-line enzyme-deprecation/no-mount expect(wrapper.find("svg.react-datepicker__calendar-icon")).toHaveLength(1); }); }); diff --git a/test/calendar_test.test.js b/test/calendar_test.test.js index ee6960771..c92435441 100644 --- a/test/calendar_test.test.js +++ b/test/calendar_test.test.js @@ -27,6 +27,7 @@ describe("Calendar", () => { function getCalendar(extraProps) { return shallow( + // eslint-disable-line enzyme-deprecation/no-shallow {}} @@ -175,6 +176,7 @@ describe("Calendar", () => { const func = (date) => (isSunday(date) ? "sunday" : undefined); const calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should render custom header with show time select", () => { const calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should track the currently hovered day", () => { const calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should clear the hovered day when the mouse leaves", () => { const calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("uses weekdaysShort instead of weekdaysMin provided useWeekdaysShort prop is present", () => { const calendarShort = mount( + // eslint-disable-line enzyme-deprecation/no-mount { />, ); const calendarMin = mount( + // eslint-disable-line enzyme-deprecation/no-mount { beforeEach(() => { onMonthChangeSpy = jest.fn(); calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} @@ -1066,6 +1074,7 @@ describe("Calendar", () => { beforeEach(() => { onYearChangeSpy = jest.fn(); calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} @@ -1095,6 +1104,7 @@ describe("Calendar", () => { onYearChangeSpy = jest.fn(); onMonthChangeSpy = jest.fn(); calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} @@ -1140,6 +1150,7 @@ describe("Calendar", () => { beforeEach(() => { onDropdownFocusSpy = jest.fn(); calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} @@ -1258,6 +1269,7 @@ describe("Calendar", () => { describe("renderInputTimeSection", () => { const renderCalendar = (props) => mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} @@ -1287,6 +1299,7 @@ describe("Calendar", () => { describe("renderYearPicker", () => { it("should render YearPicker component", () => { let calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} @@ -1359,6 +1372,7 @@ describe("Calendar", () => { describe("when showMonthYearPicker is enabled", () => { let calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} @@ -1376,6 +1390,7 @@ describe("Calendar", () => { it("should render custom next and previous labels", () => { var calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} @@ -1424,6 +1439,7 @@ describe("Calendar", () => { describe("when showQuarterYearPicker is enabled", () => { let calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} @@ -1441,6 +1457,7 @@ describe("Calendar", () => { it("should render custom next and previous labels", () => { var calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} @@ -1490,6 +1507,7 @@ describe("Calendar", () => { describe("using click outside", () => { const clickOutsideSpy = jest.fn(); const calendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} @@ -1516,6 +1534,7 @@ describe("Calendar", () => { 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 shallowCalendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should have a previous-button with the provided aria-label for year", () => { const ariaLabel = "A label in my native language for previous year"; const shallowCalendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should have a next-button with the provided aria-label for month", () => { const ariaLabel = "A label in my native language for next month"; const shallowCalendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should have a previous-button with the provided aria-label for month", () => { const ariaLabel = "A label in my native language for previous month"; const shallowCalendar = mount( + // eslint-disable-line enzyme-deprecation/no-mount { describe("renderChildren", () => { const renderCalendar = (props) => mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} diff --git a/test/datepicker_test.test.js b/test/datepicker_test.test.js index 9e0285dfe..13ac9ee54 100644 --- a/test/datepicker_test.test.js +++ b/test/datepicker_test.test.js @@ -57,7 +57,7 @@ describe("DatePicker", () => { }); it("should allow the user to supply a wrapper component for the popper", () => { - var datePicker = mount(); + var datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount const dateInput = datePicker.instance().input; var node = findDOMNode(dateInput); @@ -68,7 +68,7 @@ describe("DatePicker", () => { }); it("should allow the user to pass a wrapper component for the calendar", () => { - var datePicker = mount(); + var datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount let dateInput = datePicker.instance().input; var node = findDOMNode(dateInput); @@ -80,7 +80,7 @@ describe("DatePicker", () => { }); it("should pass a custom class to the popper container", () => { - var datePicker = mount(); + var datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount var dateInput = datePicker.instance().input; var node = findDOMNode(dateInput); TestUtils.Simulate.focus(node); @@ -198,6 +198,7 @@ describe("DatePicker", () => { it("should not re-focus the date input when focusing the year dropdown", () => { const onBlurSpy = jest.fn(); const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should fire onYearChange when the year is selected", () => { const onYearChangeSpy = jest.fn(); const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount { expect(cleared).toBe(true); }); it("should correctly update the input when the value prop changes", () => { - const datePicker = mount(); + const datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount expect(datePicker.find("input").prop("value")).toBe(""); datePicker.setProps({ value: "foo" }); expect(datePicker.find("input").prop("value")).toBe("foo"); @@ -1316,6 +1318,7 @@ describe("DatePicker", () => { it("should preserve user input as they are typing", () => { const onChange = (date) => datePicker.setProps({ selected: date }); const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount { }); it("should allow onChangeRaw to prevent a change", () => { const onChangeRaw = (e) => e.target.value > "2" && e.preventDefault(); - const datePicker = mount(); + const datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount expect(datePicker.find("input").prop("value")).toBe(""); datePicker.find("input").simulate("change", { target: { value: "3" } }); datePicker.update(); @@ -1433,6 +1436,7 @@ describe("DatePicker", () => { }); it("should handle a click outside of the calendar", () => { const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ).instance(); const openSpy = jest.spyOn(datePicker, "setOpen"); @@ -1441,6 +1445,7 @@ describe("DatePicker", () => { }); it("should default to the currently selected date", () => { const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); expect( @@ -1449,6 +1454,7 @@ describe("DatePicker", () => { }); it("should default to the start date when selecting an end date", () => { const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); expect( @@ -1457,6 +1463,7 @@ describe("DatePicker", () => { }); it("should default to the end date when selecting a start date", () => { const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); expect( @@ -1465,6 +1472,7 @@ describe("DatePicker", () => { }); it("should default to a date <= maxDate", () => { const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); expect( @@ -1473,6 +1481,7 @@ describe("DatePicker", () => { }); it("should default to a date >= minDate", () => { const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); expect( @@ -1481,6 +1490,7 @@ describe("DatePicker", () => { }); it("should default to the openToDate if there is one", () => { const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); expect( @@ -1488,13 +1498,13 @@ describe("DatePicker", () => { ).toBe("2020-01-23"); }); it("should otherwise default to the current date", () => { - const datePicker = mount(); + const datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount expect( utils.formatDate(datePicker.state("preSelection"), "yyyy-MM-dd"), ).toBe(utils.formatDate(utils.newDate(), "yyyy-MM-dd")); }); it("should support an initial null `selected` value in inline mode", () => { - const datePicker = mount(); + const datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount expect(() => datePicker.setProps({ selected: utils.newDate() }), @@ -1503,7 +1513,7 @@ describe("DatePicker", () => { it("should switch month in inline mode immediately", () => { const selected = utils.newDate(); const future = utils.addDays(utils.newDate(), 100); - const datePicker = mount(); + const datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount expect( utils.formatDate(datePicker.state("preSelection"), "yyyy-MM-dd"), ).toBe(utils.formatDate(selected, "yyyy-MM-dd")); @@ -1515,7 +1525,7 @@ describe("DatePicker", () => { it("should switch month in inline mode immediately, when year is updated", () => { const selected = utils.newDate(); const future = utils.addYears(utils.newDate(), 1); - const datePicker = mount(); + const datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount expect( utils.formatDate(datePicker.state("preSelection"), "yyyy-MM-dd"), ).toBe(utils.formatDate(selected, "yyyy-MM-dd")); @@ -1559,14 +1569,14 @@ describe("DatePicker", () => { }); it("should fire onInputClick when input is clicked", () => { const onInputClickSpy = jest.fn(); - mount() + mount() // eslint-disable-line enzyme-deprecation/no-mount .find("input") .simulate("click"); expect(onInputClickSpy).toHaveBeenCalledTimes(1); }); it("should set monthSelectedIn to 0 if monthsShown prop changes", () => { - const datePicker = mount(); + const datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount datePicker.setState({ monthSelectedIn: 1 }, () => { expect(datePicker.state("monthSelectedIn")).toEqual(1); datePicker.setProps({ monthsShown: 1 }, () => { @@ -1626,6 +1636,7 @@ describe("DatePicker", () => { it("should pass chooseDayAriaLabelPrefix prop to the correct child component", () => { const chooseDayAriaLabelPrefix = "My choose-day-prefix"; const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); expect( @@ -1636,6 +1647,7 @@ describe("DatePicker", () => { it("should pass disabledDayAriaLabelPrefix prop to the correct child component", () => { const disabledDayAriaLabelPrefix = "My disabled-day-prefix"; const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should pass weekAriaLabelPrefix prop to the correct child component", () => { const weekAriaLabelPrefix = "My week-prefix"; const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should pass monthAriaLabelPrefix prop to the correct child component", () => { const monthAriaLabelPrefix = "My month-prefix"; const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount { describe("duplicate dates when multiple months", () => { it("should find duplicates at end on all months except last month", () => { - const twoMonths = mount(); + const twoMonths = mount(); // eslint-disable-line enzyme-deprecation/no-mount twoMonths.find("input").simulate("click"); const months = twoMonths.find(Month); expect(months).toHaveLength(2); expect(months.first().props().monthShowsDuplicateDaysEnd).toBe(true); expect(months.last().props().monthShowsDuplicateDaysEnd).toBe(false); - const moreThanTwoMonths = mount(); + const moreThanTwoMonths = mount(); // eslint-disable-line enzyme-deprecation/no-mount moreThanTwoMonths.find("input").simulate("click"); const monthsMore = moreThanTwoMonths.find(Month); expect(monthsMore).toHaveLength(4); @@ -1946,14 +1960,14 @@ describe("DatePicker", () => { }); it("should find duplicates at start on all months except first month", () => { - const twoMonths = mount(); + const twoMonths = mount(); // eslint-disable-line enzyme-deprecation/no-mount twoMonths.find("input").simulate("click"); const months = twoMonths.find(Month); expect(months).toHaveLength(2); expect(months.first().props().monthShowsDuplicateDaysStart).toBe(false); expect(months.last().props().monthShowsDuplicateDaysStart).toBe(true); - const moreThanTwoMonths = mount(); + const moreThanTwoMonths = mount(); // eslint-disable-line enzyme-deprecation/no-mount moreThanTwoMonths.find("input").simulate("click"); const monthsMore = moreThanTwoMonths.find(Month); expect(monthsMore).toHaveLength(4); @@ -1966,7 +1980,7 @@ describe("DatePicker", () => { }); it("should not find duplicates when single month displayed", () => { - const datepicker = mount(); + const datepicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount datepicker.find("input").simulate("click"); const months = datepicker.find(Month); expect(months).toHaveLength(1); @@ -2042,7 +2056,7 @@ describe("DatePicker", () => { it("should show the correct start of week for GB locale", () => { registerLocale("en-GB", enGB); - const datePicker = mount(); + const datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount const dateInput = datePicker.instance().input; const dateInputWrapper = datePicker.find("input"); jest.spyOn(dateInput, "focus"); @@ -2059,7 +2073,7 @@ describe("DatePicker", () => { it("should show the correct start of week for US locale", () => { registerLocale("en-US", enUS); - const datePicker = mount(); + const datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount const dateInput = datePicker.instance().input; const dateInputWrapper = datePicker.find("input"); jest.spyOn(dateInput, "focus"); @@ -2292,6 +2306,7 @@ describe("DatePicker", () => { const onYearMouseEnterSpy = jest.fn(); const onYearMouseLeaveSpy = jest.fn(); const datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount ); + return shallow(); // eslint-disable-line enzyme-deprecation/no-shallow } describe("Day", () => { @@ -67,7 +67,7 @@ describe("Day", () => { }); it('should set aria-selected attribute to "true"', () => { - const ariaSelected = mount(shallowDay.getElement()) + const ariaSelected = mount(shallowDay.getElement()) // eslint-disable-line enzyme-deprecation/no-mount .getDOMNode() .getAttribute("aria-selected"); expect(ariaSelected).toBe("true"); @@ -78,7 +78,7 @@ describe("Day", () => { const startDate = subDays(day, 1); const endDate = addDays(day, 1); const shallowDay = renderDay(day, { startDate, endDate }); - const ariaSelected = mount(shallowDay.getElement()) + const ariaSelected = mount(shallowDay.getElement()) // eslint-disable-line enzyme-deprecation/no-mount .getDOMNode() .getAttribute("aria-selected"); expect(ariaSelected).toBe("true"); @@ -97,7 +97,7 @@ describe("Day", () => { }); it('should set aria-selected attribute to "false"', () => { - const ariaSelected = mount(shallowDay.getElement()) + const ariaSelected = mount(shallowDay.getElement()) // eslint-disable-line enzyme-deprecation/no-mount .getDOMNode() .getAttribute("aria-selected"); expect(ariaSelected).toBe("false"); @@ -694,6 +694,7 @@ describe("Day", () => { it("should hide days outside month at end when duplicates", () => { const day = newDate("2021-03-17"); const wrapper = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); expect(wrapper.text()).toHaveLength(0); @@ -701,13 +702,14 @@ describe("Day", () => { it("should show days outside month at end when not duplicates", () => { const day = newDate("2020-03-17"); - const wrapper = mount(); + const wrapper = mount(); // eslint-disable-line enzyme-deprecation/no-mount expect(wrapper.text()).toBe(day.getDate().toString()); }); it("should hide days outside month at start when duplicates", () => { const day = newDate("2020-10-05"); const wrapper = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should show days outside month at start when not duplicates", () => { const day = newDate("2020-10-05"); - const wrapper = mount(); + const wrapper = mount(); // eslint-disable-line enzyme-deprecation/no-mount expect(wrapper.text()).toBe(day.getDate().toString()); }); it("should show days in month when duplicates at start/end", () => { const day = newDate("2020-11-15"); const wrapper = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should call onClick if day is enabled", () => { const day = newDate(); - const dayNode = shallow(); + const dayNode = shallow(); // eslint-disable-line enzyme-deprecation/no-shallow dayNode.find(".react-datepicker__day").simulate("click"); expect(onClickCalled).toBe(true); }); @@ -863,6 +866,7 @@ describe("Day", () => { it("should not call onClick if day is disabled", () => { const day = newDate(); const dayNode = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow , ); dayNode.find(".react-datepicker__day").simulate("click"); @@ -872,6 +876,7 @@ describe("Day", () => { it("should not call onClick if day is within excluded interval", () => { const day = newDate(); const dayNode = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow { it("should apply focus to the preselected day", () => { const day = newDate(); const dayInstance = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ).instance(); @@ -1039,6 +1045,7 @@ describe("Day", () => { it("should not apply focus to the preselected day if inline", () => { const day = newDate(); const dayInstance = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ).instance(); diff --git a/test/exclude_time_period_test.test.js b/test/exclude_time_period_test.test.js index b891897da..66252b475 100644 --- a/test/exclude_time_period_test.test.js +++ b/test/exclude_time_period_test.test.js @@ -7,6 +7,7 @@ describe("DatePicker", () => { it("should only display times between minTime and maxTime", () => { var now = utils.newDate(); var datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should show times specified in injectTimes props", () => { const today = utils.getStartOfDay(utils.newDate()); const timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not affect existing time intervals", () => { const today = utils.getStartOfDay(utils.newDate()); const timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should allow multiple injected times per interval", () => { const today = utils.getStartOfDay(utils.newDate()); const timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should sort injected times automatically", () => { const today = utils.getStartOfDay(utils.newDate()); const timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { function getMonthDropdown(overrideProps) { return mount( + // eslint-disable-line enzyme-deprecation/no-mount { const monthNames = range(0, 12).map((M) => getMonthInLocale(M)); const onCancelSpy = jest.fn(); const monthDropdownOptionsInstance = mount( + // eslint-disable-line enzyme-deprecation/no-mount { const className = "customClassName"; const monthClassNameFunc = () => className; const month = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow , ); expect(month.hasClass(className)).toBe(true); }); it("should have the month CSS class", () => { - const month = shallow(); + const month = shallow(); // eslint-disable-line enzyme-deprecation/no-shallow expect(month.hasClass("react-datepicker__month")).toBe(true); }); @@ -50,6 +51,7 @@ describe("Month", () => { it("should have an aria-label containing the provided prefix", () => { const ariaLabelPrefix = "A prefix in my native language"; const shallowMonth = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow , ); expect( @@ -61,7 +63,7 @@ describe("Month", () => { const monthStart = utils.newDate("2015-12-01"); assertDateRangeInclusive( - mount(), + mount(), // eslint-disable-line enzyme-deprecation/no-mount utils.getStartOfWeek(monthStart), utils.getEndOfWeek(utils.getEndOfMonth(monthStart)), ); @@ -71,7 +73,7 @@ describe("Month", () => { const monthStart = utils.newDate("2015-12-01"); assertDateRangeInclusive( - mount(), + mount(), // eslint-disable-line enzyme-deprecation/no-mount utils.getStartOfWeek(monthStart), utils.getEndOfWeek(utils.addWeeks(utils.addMonths(monthStart, 1), 1)), ); @@ -82,7 +84,7 @@ describe("Month", () => { const calendarStart = utils.getStartOfWeek(monthStart); assertDateRangeInclusive( - mount(), + mount(), // eslint-disable-line enzyme-deprecation/no-mount calendarStart, utils.getEndOfWeek(utils.addWeeks(calendarStart, 5)), ); @@ -93,7 +95,7 @@ describe("Month", () => { const calendarStart = utils.getStartOfWeek(monthStart); assertDateRangeInclusive( - mount(), + mount(), // eslint-disable-line enzyme-deprecation/no-mount calendarStart, utils.getEndOfWeek(utils.addWeeks(calendarStart, 6)), ); @@ -107,7 +109,7 @@ describe("Month", () => { } const monthStart = utils.newDate("2015-12-01"); - const month = mount(); + const month = mount(); // eslint-disable-line enzyme-deprecation/no-mount const day = month.find(Day).at(0); day.simulate("click"); @@ -122,6 +124,7 @@ describe("Month", () => { } const month = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow , ); month.simulate("mouseleave"); @@ -136,6 +139,7 @@ describe("Month", () => { } const month = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const day = month.find(Day).first(); @@ -152,6 +156,7 @@ describe("Month", () => { } const month = mount( + // eslint-disable-line enzyme-deprecation/no-mount { }); it("should have the month picker CSS class", () => { - const month = shallow(); + const month = shallow(); // eslint-disable-line enzyme-deprecation/no-shallow expect(month.hasClass("react-datepicker__monthPicker")).toBe(true); }); @@ -178,6 +183,7 @@ describe("Month", () => { const monthStart = utils.newDate("2015-12-01"); const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const month = monthComponent.find(".react-datepicker__month-text").at(6); @@ -187,6 +193,7 @@ describe("Month", () => { it("should return disabled class if current date is out of bound of minDate and maxdate", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not return disabled class if current date is before minDate but same month", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not return disabled class if current date is after maxDate but same month", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should return disabled class if specified excludeDate", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should return disabled class if specified includeDate", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should have no axe violations", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { describe("selecting month range", () => { it("should add in-selecting-range class if month is between the selecting date and end date", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should add in-selecting-range class if month is between the start date and selecting date", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should use pre selection date if selecting date is not defined", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should add in-selecting-range class for one month picker if month is between the start date and selecting date", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not add in-selecting-range class for one month picker if the start date is not defined", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not add in-selecting-range class for one month picker if the end date is defined", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should add 'selecting-range-start' class to the start selecting month", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should add 'selecting-range-end' class to the end selecting month", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { describe("selecting quarter range", () => { it("should add in-selecting-range class if quarter is between the selecting date and end date", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should add in-selecting-range class if quarter is between the start date and selecting date", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should use pre selection date if selecting date is not defined", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should add in-selecting-range class for one quarter picker if quarter is between the start date and selecting date", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not add in-selecting-range class for one quarter picker if the start date is not defined", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not add in-selecting-range class for one quarter picker if the end date is defined", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { beforeEach(() => { monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { beforeEach(() => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should return month-in-range class if month is between the start date and end date", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should return month-text--today class if month is current year's month", () => { const date = new Date(); const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const month = monthComponent @@ -644,6 +674,7 @@ describe("Month", () => { const lastYearDate = new Date(); lastYearDate.setFullYear(lastYearDate.getFullYear() - 1); const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const months = monthComponent.find(".react-datepicker__month-text--today"); @@ -653,6 +684,7 @@ describe("Month", () => { it("should include aria-current property if month is current year's month", () => { const date = new Date(); const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const ariaCurrent = monthComponent @@ -665,6 +697,7 @@ describe("Month", () => { const lastYearDate = new Date(); lastYearDate.setFullYear(lastYearDate.getFullYear() - 1); const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const ariaCurrent = monthComponent @@ -676,6 +709,7 @@ describe("Month", () => { it("should have the quarter picker CSS class", () => { const month = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow , ); expect(month.hasClass("react-datepicker__quarterPicker")).toBe(true); @@ -690,6 +724,7 @@ describe("Month", () => { const monthStart = utils.newDate("2015-12-01"); const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const quarter = monthComponent @@ -701,6 +736,7 @@ describe("Month", () => { it("should return disabled class if current date is out of bound of minDate and maxdate", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { beforeEach(() => { monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { beforeEach(() => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should return quarter-in-range class if quarter is between the start date and end date", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should enable keyboard focus on the preselected component", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should render full month name", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should render short month name", () => { const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const month = monthComponent.find(".react-datepicker__month-1").at(0); @@ -830,6 +872,7 @@ describe("Month", () => { return custom render; } const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { return custom render; } const monthComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { describe("Keyboard navigation", () => { const renderQuarters = (props) => - shallow(); + shallow(); // eslint-disable-line enzyme-deprecation/no-shallow it("should trigger setPreSelection and set Q3 as pre-selected on arrowRight", () => { let preSelected = false; @@ -914,6 +958,7 @@ describe("Month", () => { describe("monthsFourColumns", () => { const renderMonth = (props) => mount( + // eslint-disable-line enzyme-deprecation/no-mount { }); describe("monthsThreeColumns", () => { const renderMonth = (props) => - mount(); + mount(); // eslint-disable-line enzyme-deprecation/no-mount it("should trigger setPreSelection and set March as pre-selected on arrowRight", () => { let preSelected = false; @@ -1272,6 +1317,7 @@ describe("Month", () => { describe("monthsTwoColumns", () => { const renderMonth = (props) => mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); @@ -1449,7 +1495,7 @@ describe("Month", () => { }); const renderMonth = (props) => - mount(); + mount(); // eslint-disable-line enzyme-deprecation/no-mount it("should select March when Enter is pressed", () => { let preSelected = false; @@ -1570,7 +1616,7 @@ describe("Month", () => { describe("if keyboard navigation is disabled", () => { const renderMonth = (props) => - mount(); + mount(); // eslint-disable-line enzyme-deprecation/no-mount it("should not have the selected class", () => { let preSelected = utils.newDate("2015-08-01"); diff --git a/test/month_year_dropdown_test.test.js b/test/month_year_dropdown_test.test.js index 92a1a5075..487bc5ac1 100644 --- a/test/month_year_dropdown_test.test.js +++ b/test/month_year_dropdown_test.test.js @@ -26,6 +26,7 @@ describe("MonthYearDropdown", () => { const maxDate = newDate("2018-06-30"); return mount( + // eslint-disable-line enzyme-deprecation/no-mount { const onCancelSpy = jest.fn(); const monthYearDropdownOptionsInstance = mount( + // eslint-disable-line enzyme-deprecation/no-mount {}} diff --git a/test/show_time_test.test.js b/test/show_time_test.test.js index 7ee07b5a1..52cf0da66 100644 --- a/test/show_time_test.test.js +++ b/test/show_time_test.test.js @@ -5,13 +5,13 @@ import TimeComponent from "../src/time.jsx"; describe("DatePicker", () => { it("should show time component when showTimeSelect prop is present", () => { - var datePicker = mount(); + var datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount var timeComponent = datePicker.find(TimeComponent); expect(timeComponent).not.toBeNull(); }); it("should have custom time caption", () => { - const timeComponent = mount(); + const timeComponent = mount(); // eslint-disable-line enzyme-deprecation/no-mount const caption = timeComponent.find(".react-datepicker-time__header"); expect(caption.text()).toEqual("Custom time"); @@ -21,6 +21,7 @@ describe("DatePicker", () => { let datePicker; beforeEach(() => { datePicker = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); datePicker.find("input").simulate("click"); diff --git a/test/time_format_test.test.js b/test/time_format_test.test.js index ef0cf6452..be293e4a4 100644 --- a/test/time_format_test.test.js +++ b/test/time_format_test.test.js @@ -29,7 +29,7 @@ describe("TimeComponent", () => { }); it("should forward the time format provided in timeFormat props", () => { - var timeComponent = mount(); + var timeComponent = mount(); // eslint-disable-line enzyme-deprecation/no-mount var timeListItem = timeComponent.find( ".react-datepicker__time-list-item", @@ -38,14 +38,14 @@ describe("TimeComponent", () => { }); it("should format the time based on the default locale (en-US)", async () => { - mount(); + mount(); // eslint-disable-line enzyme-deprecation/no-mount await waitFor(() => { expect(spy.mock.calls[0][1].innerHTML).toBe("1:00 PM"); }); }); it("should format the time based on the pt-BR locale", async () => { - mount(); + mount(); // eslint-disable-line enzyme-deprecation/no-mount await waitFor(() => { expect(spy.mock.calls[0][1].innerHTML).toBe("13:00"); }); @@ -59,21 +59,21 @@ describe("TimeComponent", () => { }); it("should call calcCenterPosition once", async () => { - mount(); + mount(); // eslint-disable-line enzyme-deprecation/no-mount await waitFor(() => { expect(spy).toHaveBeenCalled(); }); }); it("should call calcCenterPosition with centerLi ref, closest to the current time", async () => { - mount(); + mount(); // eslint-disable-line enzyme-deprecation/no-mount await waitFor(() => { expect(spy.mock.calls[0][1].innerHTML).toBe("13:00"); }); }); it("with five minute time interval, should call calcCenterPosition with centerLi ref, closest to the current time", async () => { - mount(); + mount(); // eslint-disable-line enzyme-deprecation/no-mount await waitFor(() => { expect(spy.mock.calls[0][1].innerHTML).toBe("13:25"); }); @@ -81,6 +81,7 @@ describe("TimeComponent", () => { it("should call calcCenterPosition with centerLi ref, closest to the selected time", async () => { mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should call calcCenterPosition with centerLi ref, which is selected", async () => { mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should add the aria-selected property to the selected item", () => { var timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should enable keyboard focus on the selected item", () => { var timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not add the aria-selected property to a regular item", () => { var timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should disable keyboard focus on a regular item", () => { var timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("when no selected time, should focus the time closest to the opened time", () => { var timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("when no selected time, should call calcCenterPosition with centerLi ref, closest to the opened time", async () => { mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("when no selected time, should call calcCenterPosition with centerLi ref, and no time should be selected", async () => { mount( + // eslint-disable-line enzyme-deprecation/no-mount { }); it("should show time component when showTimeSelect prop is present", () => { - const datePicker = mount(); + const datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount const component = datePicker.find(InputTimeComponent); expect(component).not.toBeNull(); }); it("should have custom time caption", () => { const timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const caption = timeComponent.find(".react-datepicker-time__caption"); @@ -24,7 +25,7 @@ describe("timeInput", () => { }); xit("should trigger onChange event", () => { - const timeComponent = shallow(); + const timeComponent = shallow(); // eslint-disable-line enzyme-deprecation/no-shallow const input = timeComponent.find("input"); input.simulate("change", { target: { value: "13:00" } }); expect(timeComponent.state("time")).toEqual("13:00"); @@ -32,6 +33,7 @@ describe("timeInput", () => { it("should trigger onChange event and set the value as last valid timeString if empty string is passed as time input value", () => { const timeComponent = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow {}} />, ); const input = timeComponent.find("input"); @@ -41,6 +43,7 @@ describe("timeInput", () => { xit("should trigger onChange event on a custom time input without using the last valid timeString", () => { const timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount } @@ -55,6 +58,7 @@ describe("timeInput", () => { xit("should pass pure Date to custom time input", () => { const onTimeChangeSpy = jest.fn(); const timeComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { const mockDate = new Date("2023-09-30"); const timeComponent = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow , ); @@ -98,6 +103,7 @@ describe("timeInput", () => { .mockImplementation(() => mockCurrentDate); const timeComponent = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow , ); diff --git a/test/week_number_test.test.js b/test/week_number_test.test.js index 1f2a0037d..8424e09e4 100644 --- a/test/week_number_test.test.js +++ b/test/week_number_test.test.js @@ -3,7 +3,7 @@ import WeekNumber from "../src/week_number"; import { shallow } from "enzyme"; function renderWeekNumber(weekNumber, props = {}) { - return shallow(); + return shallow(); // eslint-disable-line enzyme-deprecation/no-shallow } describe("WeekNumber", () => { @@ -21,6 +21,7 @@ describe("WeekNumber", () => { it("should call the onClick function if it is defined", () => { const onClick = jest.fn(); shallowWeekNumber = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow , ); shallowWeekNumber.instance().handleClick({}); @@ -30,6 +31,7 @@ describe("WeekNumber", () => { it("should have an aria-label containing the provided prefix", () => { const ariaLabelPrefix = "A prefix in my native language"; const shallowWeekNumber = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow , ); expect( diff --git a/test/week_test.test.js b/test/week_test.test.js index a071c7b4b..b4c2f4c6f 100644 --- a/test/week_test.test.js +++ b/test/week_test.test.js @@ -7,13 +7,13 @@ import * as utils from "../src/date_utils"; describe("Week", () => { it("should have the week CSS class", () => { - const week = shallow(); + const week = shallow(); // eslint-disable-line enzyme-deprecation/no-shallow expect(week.hasClass("react-datepicker__week")).toBe(true); }); it("should render the days of the week", () => { const weekStart = utils.getStartOfWeek(utils.newDate("2015-12-20")); - const week = shallow(); + const week = shallow(); // eslint-disable-line enzyme-deprecation/no-shallow const days = week.find(Day); expect(days.length).toBe(7); @@ -28,7 +28,7 @@ describe("Week", () => { it("should render the week number", () => { const weekStart = utils.getStartOfWeek(utils.newDate("2015-12-20")); - const week = shallow(); + const week = shallow(); // eslint-disable-line enzyme-deprecation/no-shallow const days = week.find(Day); expect(days.length).toBe(7); @@ -49,7 +49,7 @@ describe("Week", () => { } const weekStart = utils.newDate("2015-12-20"); - const week = shallow(); + const week = shallow(); // eslint-disable-line enzyme-deprecation/no-shallow const day = week.find(Day).at(0); day.simulate("click"); expect(day.prop("day")).toEqual(dayClicked); @@ -65,6 +65,7 @@ describe("Week", () => { const weekStart = utils.newDate("2015-12-20"); const setOpenSpy = jest.fn(); const week = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow { const setOpenSpy = jest.fn(); const week = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow { const setOnWeekSelect = jest.fn(); const week = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow { const weekStart = utils.newDate("2015-12-20"); const realWeekNumber = utils.getWeek(weekStart); const week = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow { const weekStart = utils.newDate("2015-12-20"); const week = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow { const weekStart = utils.newDate(); const week = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow , ); const day = week.find(Day).first(); diff --git a/test/year_dropdown_options_test.test.js b/test/year_dropdown_options_test.test.js index 242c477bd..b54b070f8 100644 --- a/test/year_dropdown_options_test.test.js +++ b/test/year_dropdown_options_test.test.js @@ -13,6 +13,7 @@ describe("YearDropdownOptions", () => { beforeEach(() => { onCancelSpy = jest.fn(); yearDropdown = mount( + // eslint-disable-line enzyme-deprecation/no-mount { const onCancelSpy = jest.fn(); const onChangeSpy = jest.fn(); const yearDropdown = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow { const minDate = utils.newDate(); const maxDate = utils.addYears(utils.newDate(), 1); const yearDropdown = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow { const minDate = utils.newDate(); const maxDate = utils.addYears(utils.newDate(), 1); const yearDropdown = mount( + // eslint-disable-line enzyme-deprecation/no-mount { const minDate = utils.subYears(utils.newDate(), 11); const maxDate = utils.addYears(utils.newDate(), 11); const yearDropdown = mount( + // eslint-disable-line enzyme-deprecation/no-mount { const onChangeSpy = jest.fn(); const minDate = utils.subYears(utils.newDate(), 11); const yearDropdown = mount( + // eslint-disable-line enzyme-deprecation/no-mount { const onChangeSpy = jest.fn(); const maxDate = utils.addYears(utils.newDate(), 11); const yearDropdown = mount( + // eslint-disable-line enzyme-deprecation/no-mount { const onCancelSpy = jest.fn(); const onChangeSpy = jest.fn(); const yearDropdown = shallow( + // eslint-disable-line enzyme-deprecation/no-shallow { const onCancelSpy = jest.fn(); const onChangeSpy = jest.fn(); const yearDropdownInstance = mount( + // eslint-disable-line enzyme-deprecation/no-mount { function getYearDropdown(overrideProps) { return mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should show year picker component when showYearPicker prop is present", () => { - const datePicker = mount(); + const datePicker = mount(); // eslint-disable-line enzyme-deprecation/no-mount const component = datePicker.find(Year); expect(component).toBeDefined(); }); it("should show year picker component with default year item number", () => { - const yearComponent = mount(); + const yearComponent = mount(); // eslint-disable-line enzyme-deprecation/no-mount const yearItems = yearComponent.find(".react-datepicker__year-text"); expect(yearItems.length).toBe(utils.DEFAULT_YEAR_ITEM_NUMBER); }); @@ -23,6 +23,7 @@ describe("YearPicker", () => { it("should show year picker component with specific year item number", () => { const yearItemNumber = 9; const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const yearItems = yearComponent.find(".react-datepicker__year-text"); @@ -32,6 +33,7 @@ describe("YearPicker", () => { it("should change the year when clicked on any option in the picker", () => { const onYearChangeSpy = jest.fn(); const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const firstYearDiv = yearComponent @@ -43,7 +45,7 @@ describe("YearPicker", () => { it("should has selected class when element of array equal of choosen year", () => { const date = new Date("2015-01-01"); - const yearComponent = mount(); + const yearComponent = mount(); // eslint-disable-line enzyme-deprecation/no-mount const year = yearComponent .find(".react-datepicker__year-text--selected") .at(0) @@ -53,7 +55,7 @@ describe("YearPicker", () => { it("should have current year class when element of array equal of current year", () => { const date = new Date(); - const yearComponent = mount(); + const yearComponent = mount(); // eslint-disable-line enzyme-deprecation/no-mount const year = yearComponent .find(".react-datepicker__year-text--today") .at(0) @@ -63,7 +65,7 @@ describe("YearPicker", () => { it("should have aria-current date when element of array equal to current year", () => { const date = new Date(); - const yearComponent = mount(); + const yearComponent = mount(); // eslint-disable-line enzyme-deprecation/no-mount const ariaCurrent = yearComponent .find(".react-datepicker__year-text--today") .prop("aria-current"); @@ -72,7 +74,7 @@ describe("YearPicker", () => { it("should not have aria-current date when element of array does not equal current year", () => { const date = new Date("2015-01-01"); - const yearComponent = mount(); + const yearComponent = mount(); // eslint-disable-line enzyme-deprecation/no-mount const ariaCurrent = yearComponent .find(".react-datepicker__year-text") .at(0) @@ -82,6 +84,7 @@ describe("YearPicker", () => { it("should return disabled class if current date is out of bound of minDate and maxdate", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not return disabled class if current date is before minDate but same year", () => { const date = utils.newDate("2023-01-01"); const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const yearTexts = yearComponent.find(".react-datepicker__year-text"); @@ -113,6 +117,7 @@ describe("YearPicker", () => { it("should not return disabled class if current date is after maxDate but same year", () => { const date = utils.newDate("2023-12-31"); const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const yearTexts = yearComponent.find(".react-datepicker__year-text"); @@ -141,6 +146,7 @@ describe("YearPicker", () => { } const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); @@ -164,6 +170,7 @@ describe("YearPicker", () => { includeDates.push(utils.newDate(`${year}-01-01`)); } const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); @@ -187,6 +194,7 @@ describe("YearPicker", () => { return custom render; } const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount , ); const year = yearComponent.find(".react-datepicker__year-text").at(0); @@ -196,6 +204,7 @@ describe("YearPicker", () => { describe("range", () => { it("should add range classes", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not add range classes when start date is not defined", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not add range classes when end date is not defined", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { describe("selecting", () => { it("should add in-selecting-range class if year is between the selecting date and end date", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should add in-selecting-range class if year is between the start date and selecting date", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should use pre selection date if selecting date is not defined", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should add in-selecting-range class for one year picker if year is between the start date and selecting date", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not add in-selecting-range class for one year picker if the start date is not defined", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should not add in-selecting-range class for one year picker if the end date is defined", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should add 'selecting-range-start' class to the start selecting year", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount { it("should add 'selecting-range-end' class to the end selecting year", () => { const yearComponent = mount( + // eslint-disable-line enzyme-deprecation/no-mount