Browse Source
add style and focus-trap mocks for jest
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
pull/8832/head
Maksim Sukharev
3 years ago
No known key found for this signature in database
GPG Key ID: 6349D071889BD1D5
3 changed files with
17 additions and
0 deletions
-
jest.config.js
-
src/__mocks__/styles.js
-
src/__mocks__/tabbable.js
|
|
|
@ -59,6 +59,10 @@ module.exports = { |
|
|
|
'vue', |
|
|
|
], |
|
|
|
|
|
|
|
moduleNameMapper: { |
|
|
|
'\\.(css|scss)$': '<rootDir>/src/__mocks__/styles.js', |
|
|
|
}, |
|
|
|
|
|
|
|
transform: { |
|
|
|
// process `*.js` files with `babel-jest`
|
|
|
|
'.*\\.(js)$': 'babel-jest', |
|
|
|
|
|
|
|
@ -0,0 +1 @@ |
|
|
|
module.exports = {} |
|
|
|
@ -0,0 +1,12 @@ |
|
|
|
// 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 |