Skip to content

Commit 6a6b109

Browse files
committed
chore(utils): remove ResizeObserver component and useResizeObserverV1 implementation
BREAKING CHANGE: Removed `ResizeObserver` component and `useResizeObserverV1` implementation
1 parent 216c8ef commit 6a6b109

File tree

6 files changed

+4
-690
lines changed

6 files changed

+4
-690
lines changed

packages/utils/src/sizing/ResizeObserver.tsx

Lines changed: 0 additions & 115 deletions
This file was deleted.

packages/utils/src/sizing/__tests__/useResizeObserver.tsx

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/* eslint-disable no-underscore-dangle */
2-
import React, { useRef } from "react";
1+
import React from "react";
32
import { act, render } from "@testing-library/react";
43
import { ResizeObserver } from "@juggle/resize-observer";
54
import { mocked } from "ts-jest/utils";
@@ -113,33 +112,6 @@ describe("useResizeObserver", () => {
113112
ResizeObserverMock.mockRestore();
114113
});
115114

116-
it("should use the v1 behavior if the first arg is an object", () => {
117-
const warn = jest.spyOn(console, "warn");
118-
warn.mockImplementation(() => {});
119-
const onResize = jest.fn();
120-
const Test = () => {
121-
const ref = useRef<HTMLDivElement | null>(null);
122-
useResizeObserver({
123-
onResize,
124-
target: ref,
125-
});
126-
return <div ref={ref} data-testid="div" />;
127-
};
128-
129-
const { getByTestId, unmount } = render(<Test />);
130-
const div = getByTestId("div");
131-
expect(observe).toBeCalledWith(div);
132-
expect(observe).toBeCalledTimes(1);
133-
134-
unmount();
135-
expect(observe).toBeCalledTimes(1);
136-
expect(unobserve).toBeCalledWith(div);
137-
expect(unobserve).toBeCalledTimes(1);
138-
expect(disconnect).toBeCalledTimes(1);
139-
140-
warn.mockRestore();
141-
});
142-
143115
it("should use the ref API if the first argument is a function", () => {
144116
const onResize = jest.fn();
145117
const Test = () => {

0 commit comments

Comments
 (0)