Skip to content

Commit

Permalink
Merge pull request #4190 from Hacker0x01/react-18-deprecations
Browse files Browse the repository at this point in the history
Update usage of findDOMNode
  • Loading branch information
martijnrusschen committed Oct 9, 2023
2 parents 8b28bb7 + fc64949 commit 63dc732
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 113 deletions.
24 changes: 12 additions & 12 deletions test/calendar_test.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React from "react";
import Calendar from "../src/calendar";
import Month from "../src/month";
import Day from "../src/day";
import ReactDOM from "react-dom";
import { findDOMNode } from "react-dom";
import TestUtils from "react-dom/test-utils";
import YearDropdown from "../src/year_dropdown";
import MonthDropdown from "../src/month_dropdown";
Expand Down Expand Up @@ -933,7 +933,7 @@ describe("Calendar", () => {
}}
/>,
);
TestUtils.Simulate.focus(ReactDOM.findDOMNode(datePicker.input));
TestUtils.Simulate.focus(findDOMNode(datePicker.input));
const calendar = TestUtils.scryRenderedComponentsWithType(
datePicker.calendar,
Calendar,
Expand All @@ -958,7 +958,7 @@ describe("Calendar", () => {
}}
/>,
);
TestUtils.Simulate.focus(ReactDOM.findDOMNode(datePicker.input));
TestUtils.Simulate.focus(findDOMNode(datePicker.input));
const calendar = TestUtils.scryRenderedComponentsWithType(
datePicker.calendar,
Calendar,
Expand All @@ -983,7 +983,7 @@ describe("Calendar", () => {
}}
/>,
);
TestUtils.Simulate.focus(ReactDOM.findDOMNode(datePicker.input));
TestUtils.Simulate.focus(findDOMNode(datePicker.input));
const calendar = TestUtils.scryRenderedComponentsWithType(
datePicker.calendar,
Calendar,
Expand All @@ -1007,11 +1007,11 @@ describe("Calendar", () => {
/>,
);

TestUtils.Simulate.focus(ReactDOM.findDOMNode(datePicker.input));
TestUtils.Simulate.focus(findDOMNode(datePicker.input));

expect(onCalendarOpen).toHaveBeenCalled();

TestUtils.Simulate.blur(ReactDOM.findDOMNode(datePicker.input));
TestUtils.Simulate.blur(findDOMNode(datePicker.input));

expect(onCalendarOpen).toHaveBeenCalled();
});
Expand Down Expand Up @@ -1585,7 +1585,7 @@ describe("Calendar", () => {
<DatePicker selected={selected} />,
);
const dateInput = datePicker.input;
TestUtils.Simulate.focus(ReactDOM.findDOMNode(dateInput));
TestUtils.Simulate.focus(findDOMNode(dateInput));
TestUtils.Simulate.click(
TestUtils.findRenderedDOMComponentWithClass(
datePicker,
Expand All @@ -1605,7 +1605,7 @@ describe("Calendar", () => {
<DatePicker selected={selected} />,
);
const dateInput = datePicker.input;
TestUtils.Simulate.focus(ReactDOM.findDOMNode(dateInput));
TestUtils.Simulate.focus(findDOMNode(dateInput));
TestUtils.Simulate.click(
TestUtils.findRenderedDOMComponentWithClass(
datePicker,
Expand Down Expand Up @@ -1662,7 +1662,7 @@ describe("Calendar", () => {
onKeyDown={onKeyDownSpy}
/>,
);
TestUtils.Simulate.focus(ReactDOM.findDOMNode(datePicker.input));
TestUtils.Simulate.focus(findDOMNode(datePicker.input));
const prevMonthButton = TestUtils.findRenderedDOMComponentWithClass(
datePicker,
"react-datepicker__navigation--previous",
Expand All @@ -1683,7 +1683,7 @@ describe("Calendar", () => {
onKeyDown={onKeyDownSpy}
/>,
);
TestUtils.Simulate.focus(ReactDOM.findDOMNode(datePicker.input));
TestUtils.Simulate.focus(findDOMNode(datePicker.input));
const nextMonthButton = TestUtils.findRenderedDOMComponentWithClass(
datePicker,
"react-datepicker__navigation--next",
Expand Down Expand Up @@ -1733,7 +1733,7 @@ describe("Calendar", () => {
);
const dateInput = datePicker.input;

TestUtils.Simulate.focus(ReactDOM.findDOMNode(dateInput));
TestUtils.Simulate.focus(findDOMNode(dateInput));

const calendar = TestUtils.scryRenderedComponentsWithType(
datePicker.calendar,
Expand Down Expand Up @@ -1764,7 +1764,7 @@ describe("Calendar", () => {
);
const dateInput = datePicker.input;

TestUtils.Simulate.focus(ReactDOM.findDOMNode(dateInput));
TestUtils.Simulate.focus(findDOMNode(dateInput));

const calendar = TestUtils.scryRenderedComponentsWithType(
datePicker.calendar,
Expand Down

0 comments on commit 63dc732

Please sign in to comment.