|
1 | | -/* eslint-disable no-underscore-dangle */ |
2 | | -import React, { useRef } from "react"; |
| 1 | +import React from "react"; |
3 | 2 | import { act, render } from "@testing-library/react"; |
4 | 3 | import { ResizeObserver } from "@juggle/resize-observer"; |
5 | 4 | import { mocked } from "ts-jest/utils"; |
@@ -113,33 +112,6 @@ describe("useResizeObserver", () => { |
113 | 112 | ResizeObserverMock.mockRestore(); |
114 | 113 | }); |
115 | 114 |
|
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 | | - |
143 | 115 | it("should use the ref API if the first argument is a function", () => { |
144 | 116 | const onResize = jest.fn(); |
145 | 117 | const Test = () => { |
|
0 commit comments