()
| 114 | |
| 115 | test("root option", async () => { |
| 116 | const ComponentWithRoot: React.FC = () => { |
| 117 | const rootRef = useRef<HTMLDivElement | null>(null); |
| 118 | |
| 119 | const [ref, ,, observer] = useInView({ |
| 120 | root: rootRef.current, |
| 121 | }); |
| 122 | const root = observer?.root; |
| 123 | const text = !!root; |
| 124 | |
| 125 | return ( |
| 126 | <div ref={rootRef}> |
| 127 | <div ref={ref}> |
| 128 | {text.toString()} |
| 129 | </div> |
| 130 | </div> |
| 131 | ); |
| 132 | }; |
| 133 | |
| 134 | const { getByText } = render(<ComponentWithRoot />); |
| 135 |
nothing calls this directly
no test coverage detected