File tree Expand file tree Collapse file tree 6 files changed +8
-24
lines changed Expand file tree Collapse file tree 6 files changed +8
-24
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,9 @@ describe('$bvModal', () => {
6
6
const localVue = new CreateLocalVue ( )
7
7
8
8
beforeAll ( ( ) => {
9
- // Prevent multiple Vue warnings in tests
10
- jest . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
11
- // Install plugin after we have trapped console.warn
12
9
localVue . use ( modalPlugin )
13
10
} )
14
11
15
- afterAll ( ( ) => {
16
- console . warn . mockClear ( )
17
- } )
18
-
19
12
it ( '$bvModal.show() and $bvModal.hide() works' , async ( ) => {
20
13
const App = localVue . extend ( {
21
14
render ( h ) {
Original file line number Diff line number Diff line change @@ -6,16 +6,9 @@ describe('$bvToast', () => {
6
6
const localVue = new CreateLocalVue ( )
7
7
8
8
beforeAll ( ( ) => {
9
- // Prevent multiple Vue warnings in tests
10
- jest . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
11
- // Install plugin after we have trapped console.warn
12
9
localVue . use ( toastPlugin )
13
10
} )
14
11
15
- afterAll ( ( ) => {
16
- console . warn . mockClear ( )
17
- } )
18
-
19
12
it ( '$bvToast.show() and $bvToast.hide() works' , async ( ) => {
20
13
const App = localVue . extend ( {
21
14
render ( h ) {
Original file line number Diff line number Diff line change @@ -16,13 +16,7 @@ import AlertPlugin from '../../src/components/alert'
16
16
import BVConfigPlugin from '../../src/bv-config'
17
17
18
18
describe ( 'utils/config' , ( ) => {
19
- beforeEach ( ( ) => {
20
- // Prevent multiple Vue warnings in tests
21
- jest . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
22
- } )
23
-
24
19
afterEach ( ( ) => {
25
- console . warn . mockClear ( )
26
20
resetConfig ( )
27
21
} )
28
22
Original file line number Diff line number Diff line change @@ -55,11 +55,13 @@ export const MutationObs =
55
55
// Normalize event options based on support of passive option
56
56
// Exported only for testing purposes
57
57
export const parseEventOptions = options => {
58
- if ( ! hasPassiveEventSupport ) {
58
+ /* istanbul ignore else: can't test in JSDOM, as it supports passive */
59
+ if ( hasPassiveEventSupport ) {
60
+ return isObject ( options ) ? options : { useCapture : Boolean ( options || false ) }
61
+ } else {
59
62
// Need to translate to actual Boolean value
60
63
return Boolean ( isObject ( options ) ? options . useCapture : options )
61
64
}
62
- return isObject ( options ) ? options : { useCapture : Boolean ( options || false ) }
63
65
}
64
66
65
67
// Attach an event listener to an element
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ export const hasMutationObserverSupport =
15
15
16
16
export const isBrowser = hasWindowSupport && hasDocumentSupport && hasNavigatorSupport
17
17
18
+ export const isJSDOM = isBrowser && navigator . userAgent . includes ( 'jsdom' )
19
+
18
20
// Determine if the browser supports the option passive for events
19
21
export const hasPassiveEventSupport = ( ( ) => {
20
22
let passiveEventSupported = false
Original file line number Diff line number Diff line change 1
1
import OurVue from './vue'
2
2
import warn from './warn'
3
3
import { setConfig } from './config'
4
- import { hasWindowSupport } from './env'
4
+ import { hasWindowSupport , isJSDOM } from './env'
5
5
6
6
const MULTIPLE_VUE_WARNING = `Multiple instances of Vue detected!
7
7
See: https://bootstrap-vue.js.org/docs#using-module-bundlers`
@@ -14,7 +14,7 @@ let checkMultipleVueWarned = false
14
14
*/
15
15
export const checkMultipleVue = Vue => {
16
16
/* istanbul ignore next */
17
- if ( ! checkMultipleVueWarned && OurVue !== Vue ) {
17
+ if ( ! checkMultipleVueWarned && OurVue !== Vue && ! isJSDOM ) {
18
18
warn ( MULTIPLE_VUE_WARNING )
19
19
checkMultipleVueWarned = true
20
20
}
You can’t perform that action at this time.
0 commit comments