Skip to content

Commit

Permalink
Ignore deprecated ReactDOM methods in tests (#7162)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggdouglas authored Jan 14, 2025
1 parent ebb776b commit 127e5af
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/core/test/context-menu/contextMenuTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ describe("ContextMenu", () => {
document.body.appendChild(containerElement);
});
afterEach(() => {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(containerElement!);
containerElement!.remove();
});
Expand Down
2 changes: 2 additions & 0 deletions packages/core/test/forms/textAreaTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ describe("<TextArea>", () => {
});

afterEach(() => {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(containerElement!);
containerElement!.remove();
});
Expand Down
2 changes: 2 additions & 0 deletions packages/core/test/slider/multiSliderTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ describe("<MultiSlider>", () => {
});

afterEach(() => {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(testsContainerElement);
testsContainerElement.remove();
});
Expand Down
2 changes: 2 additions & 0 deletions packages/core/test/toast/overlayToasterTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ function unmountReact16Toaster(containerElement: HTMLElement) {
if (toasterRenderRoot == null) {
throw new Error("No elements were found under Toaster container.");
}
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(toasterRenderRoot);
}

Expand Down
2 changes: 2 additions & 0 deletions packages/core/test/toast/toasterTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ describe("Toaster", () => {
});

afterEach(() => {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(testsContainerElement);
});

Expand Down
2 changes: 2 additions & 0 deletions packages/core/test/tree/treeTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ describe("<Tree>", () => {
});

afterEach(() => {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(testsContainerElement);
});

Expand Down
2 changes: 2 additions & 0 deletions packages/datetime/test/components/dateRangeInputTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ describe("<DateRangeInput>", () => {
});
afterEach(() => {
if (containerElement !== undefined) {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(containerElement);
containerElement.remove();
}
Expand Down
4 changes: 4 additions & 0 deletions packages/datetime/test/components/timePickerTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ describe("<TimePicker>", () => {
});

afterEach(() => {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(testsContainerElement);
});

Expand Down Expand Up @@ -747,6 +749,8 @@ describe("<TimePicker>", () => {
}

function renderTimePicker(props?: Partial<TimePickerProps>) {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
timePicker = ReactDOM.render<TimePickerProps>(
<TimePicker onChange={onTimePickerChange} {...props} />,
testsContainerElement,
Expand Down
2 changes: 2 additions & 0 deletions packages/datetime2/test/components/dateRangeInput3Tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ describe("<DateRangeInput3>", () => {

afterEach(() => {
if (containerElement !== undefined) {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(containerElement);
containerElement.remove();
}
Expand Down
2 changes: 2 additions & 0 deletions packages/table/test/common/internal/scrollUtilsTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ describe("scrollUtils", () => {

function mountElementsWithContentSize(contentWidth: number, contentHeight: number) {
// HACKHACK: `as unknown as HTMLElement` cast is sketchy
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
return ReactDOM.render<React.HTMLProps<HTMLDivElement>>(
<div style={parentStyle}>
<div style={{ ...baseStyles, height: contentHeight, width: contentWidth }} />
Expand Down
4 changes: 4 additions & 0 deletions packages/table/test/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,15 @@ export class ReactHarness {

public mount(component: React.ReactElement<any>) {
// wrap in a root provider to avoid console warnings
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.render(React.createElement(BlueprintProvider, { children: component }), this.container);
return new ElementHarness(this.container);
}

public unmount() {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(this.container);
}

Expand Down
4 changes: 4 additions & 0 deletions packages/table/test/locatorTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ describe("Locator", () => {
// ".body" will be the scrollable region.
containerElement = document.createElement("div");
document.body.appendChild(containerElement);
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.render(
<div className="table-wrapper" style={style}>
<div className="body" style={style}>
Expand All @@ -75,6 +77,8 @@ describe("Locator", () => {
});

afterEach(() => {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(containerElement);
});

Expand Down
4 changes: 4 additions & 0 deletions packages/table/test/quadrants/tableQuadrantStackTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ describe("TableQuadrantStack", () => {
});

afterEach(() => {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(container);
onScroll.resetHistory();
});
Expand Down Expand Up @@ -715,6 +717,8 @@ describe("TableQuadrantStack", () => {
function renderIntoDom(element: React.JSX.Element) {
const containerElement = document.createElement("div");
document.body.appendChild(containerElement);
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
const component = ReactDOM.render<any>(element, containerElement);
return {
component: component as TableQuadrantStack,
Expand Down
4 changes: 4 additions & 0 deletions packages/table/test/table2Tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ describe("<Table2>", function (this) {
afterEach(() => {
harness.unmount();
if (containerElement !== undefined) {
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
ReactDOM.unmountComponentAtNode(containerElement);
containerElement.remove();
}
Expand Down Expand Up @@ -1498,6 +1500,8 @@ describe("<Table2>", function (this) {
// get native DOM nodes
const tableNode = table.getDOMNode();
const tableBodySelector = `.${Classes.TABLE_BODY_VIRTUAL_CLIENT}`;
// TODO(React 18): Replace deprecated ReactDOM methods. See: https://github.com/palantir/blueprint/issues/7167
// eslint-disable-next-line deprecation/deprecation
const tableBodyNode = ReactDOM.findDOMNode(tableNode.querySelector(tableBodySelector));

// trigger a drag-selection starting at the center of the activation cell
Expand Down

1 comment on commit 127e5af

@svc-palantir-github
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore deprecated ReactDOM methods in tests (#7162)

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Please sign in to comment.