()
| 17 | |
| 18 | // Remove the event handler property (from whichever prototype defines it) for browsers without scrollend support |
| 19 | function simulateNoScrollEndSupport() { |
| 20 | let owner: object | null = window; |
| 21 | while ( |
| 22 | owner && |
| 23 | !Object.prototype.hasOwnProperty.call(owner, "onscrollend") |
| 24 | ) { |
| 25 | owner = Object.getPrototypeOf(owner); |
| 26 | } |
| 27 | if (!owner) { |
| 28 | return; |
| 29 | } |
| 30 | |
| 31 | const descriptor = Object.getOwnPropertyDescriptor(owner, "onscrollend")!; |
| 32 | // @ts-expect-error Simulate the property being unsupported |
| 33 | delete owner.onscrollend; |
| 34 | onTestFinished(() => { |
| 35 | Object.defineProperty(owner, "onscrollend", descriptor); |
| 36 | }); |
| 37 | } |
| 38 | |
| 39 | test("should be false until the target scrolls", () => { |
| 40 | const { result } = renderHook(() => useIsScrolling(createElement())); |
no outgoing calls
no test coverage detected