How to use the react-intersection-observer/test-utils.mockAllIsIntersecting function in react-intersection-observer

To help you get started, we’ve selected a few react-intersection-observer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maapteh / graphql-modules-app / packages / app / src / modules / product / product.spec.tsx View on Github external
it('renders correctly', async () => {
        const id = '9200000111963040';
        const testId = 'product-details';

        const { container, queryByTestId, findByText } = render(
            
                
            
        );

        mockAllIsIntersecting(true);

        expect(queryByTestId(testId)).toBe(null);
        await findByText(/De Ghost Recon/);
        expect(queryByTestId(testId)).toBeDefined();

        // generic contract
        expect(container).toMatchSnapshot();
    });
});

react-intersection-observer

Monitor if a component is inside the viewport, using IntersectionObserver API

MIT
Latest version published 18 days ago

Package Health Score

88 / 100
Full package analysis