How to use the body-scroll-lock.clearAllBodyScrollLocks.mock function in body-scroll-lock

To help you get started, we’ve selected a few body-scroll-lock 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 qantasairways / runway / src / shared / ButtonWithDialog / __test__ / Dialog.spec.js View on Github external
it('clears body scroll lock when shouldLockBgScroll is true', () => {
      component = shallow(
        <dialog>
      );
      component.instance().componentWillUnmount();

      expect(enableBodyScroll.mock.calls.length).toBe(1);
      expect(enableBodyScroll.mock.calls[0][0]).toBe('scrollTarget2');
      expect(clearAllBodyScrollLocks.mock.calls.length).toBe(1);
    });
</dialog>
github qantasairways / runway / src / shared / ButtonWithDialog / __test__ / Dialog.spec.js View on Github external
it('clears body scroll lock when shouldLockBgScroll changes to false', () =&gt; {
      component = shallow(
        <dialog>
      );
      component.instance().componentDidUpdate({ shouldLockBgScroll: true });
      expect(enableBodyScroll.mock.calls.length).toBe(1);
      expect(enableBodyScroll.mock.calls[0][0]).toBe('scrollTarget1');
      expect(clearAllBodyScrollLocks.mock.calls.length).toBe(1);
    });
</dialog>

body-scroll-lock

Enables body scroll locking (for iOS Mobile and Tablet, Android, desktop Safari/Chrome/Firefox) without breaking scrolling of a target element (eg. modal/lightbox/flyouts/nav-menus)

MIT
Latest version published 3 years ago

Package Health Score

69 / 100
Full package analysis