* Bump focus-trap from 6.7.3 to 6.8.1 Bumps [focus-trap](https://github.com/focus-trap/focus-trap) from 6.7.3 to 6.8.1. - [Release notes](https://github.com/focus-trap/focus-trap/releases) - [Changelog](https://github.com/focus-trap/focus-trap/blob/master/CHANGELOG.md) - [Commits](https://github.com/focus-trap/focus-trap/compare/v6.7.3...v6.8.1) --- updated-dependencies: - dependency-name: focus-trap dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * mock tabbable in jest Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
21 lines
735 B
JavaScript
21 lines
735 B
JavaScript
/**
|
|
* When running in Jest, we globally mock the tabbable library used by focus-trap.
|
|
* This is to work around limitations testing components which use a focus trap in JSDom.
|
|
* See: https://github.com/focus-trap/tabbable#testing-in-jsdom
|
|
*/
|
|
|
|
const lib = jest.requireActual('tabbable');
|
|
|
|
const tabbable = {
|
|
...lib,
|
|
tabbable: (node, options) =>
|
|
lib.tabbable(node, { ...options, displayCheck: 'none' }),
|
|
focusable: (node, options) =>
|
|
lib.focusable(node, { ...options, displayCheck: 'none' }),
|
|
isFocusable: (node, options) =>
|
|
lib.isFocusable(node, { ...options, displayCheck: 'none' }),
|
|
isTabbable: (node, options) =>
|
|
lib.isTabbable(node, { ...options, displayCheck: 'none' }),
|
|
};
|
|
|
|
module.exports = tabbable;
|