1
- import {
2
- mount ,
3
- config ,
4
- TransitionStub ,
5
- TransitionGroupStub ,
6
- createLocalVue
7
- } from '~vue/test-utils'
8
-
9
- describe ( 'config' , ( ) => {
1
+ import { describeWithShallowAndMount , itDoNotRunIf } from '~resources/utils'
2
+ import { config , TransitionStub , TransitionGroupStub , createLocalVue } from '~vue/test-utils'
3
+
4
+ describeWithShallowAndMount ( 'config' , ( mountingMethod ) => {
10
5
let configStubsSave
11
6
beforeEach ( ( ) => {
12
7
TransitionGroupStub . name = 'another-temp-name'
@@ -20,19 +15,20 @@ describe('config', () => {
20
15
config . stubs = configStubsSave
21
16
} )
22
17
23
- it ( 'stubs transition and transition-group by default' , ( ) => {
24
- const testComponent = {
25
- template : `
18
+ itDoNotRunIf ( mountingMethod . name === 'shallow' ,
19
+ 'stubs transition and transition-group by default' , ( ) => {
20
+ const testComponent = {
21
+ template : `
26
22
<div>
27
23
<transition><p /></transition>
28
24
<transition-group><p /><p /></transition-group>
29
25
</div>
30
26
`
31
- }
32
- const wrapper = mount ( testComponent )
33
- expect ( wrapper . contains ( TransitionStub ) ) . to . equal ( true )
34
- expect ( wrapper . contains ( TransitionGroupStub ) ) . to . equal ( true )
35
- } )
27
+ }
28
+ const wrapper = mountingMethod ( testComponent )
29
+ expect ( wrapper . contains ( TransitionStub ) ) . to . equal ( true )
30
+ expect ( wrapper . contains ( TransitionGroupStub ) ) . to . equal ( true )
31
+ } )
36
32
37
33
it ( 'mocks a global variable' , ( ) => {
38
34
const localVue = createLocalVue ( )
@@ -47,7 +43,7 @@ describe('config', () => {
47
43
48
44
config . mocks [ '$t' ] = 'mock value'
49
45
50
- const wrapper = mount ( testComponent , {
46
+ const wrapper = mountingMethod ( testComponent , {
51
47
localVue, t
52
48
} )
53
49
@@ -66,7 +62,7 @@ describe('config', () => {
66
62
67
63
config . methods [ 'val' ] = ( ) => 'method'
68
64
69
- const wrapper = mount ( testComponent )
65
+ const wrapper = mountingMethod ( testComponent )
70
66
71
67
expect ( wrapper . vm . val ( ) ) . to . equal ( 'method' )
72
68
expect ( wrapper . text ( ) ) . to . equal ( 'method' )
@@ -81,7 +77,7 @@ describe('config', () => {
81
77
`
82
78
}
83
79
config . stubs . transition = false
84
- const wrapper = mount ( testComponent )
80
+ const wrapper = mountingMethod ( testComponent )
85
81
expect ( wrapper . contains ( TransitionStub ) ) . to . equal ( false )
86
82
} )
87
83
@@ -94,7 +90,7 @@ describe('config', () => {
94
90
`
95
91
}
96
92
config . stubs [ 'transition-group' ] = false
97
- const wrapper = mount ( testComponent )
93
+ const wrapper = mountingMethod ( testComponent )
98
94
expect ( wrapper . contains ( TransitionGroupStub ) ) . to . equal ( false )
99
95
} )
100
96
@@ -107,7 +103,7 @@ describe('config', () => {
107
103
</div>
108
104
`
109
105
}
110
- const wrapper = mount ( testComponent )
106
+ const wrapper = mountingMethod ( testComponent )
111
107
expect ( wrapper . contains ( TransitionGroupStub ) ) . to . equal ( false )
112
108
expect ( wrapper . contains ( TransitionStub ) ) . to . equal ( false )
113
109
} )
@@ -121,7 +117,7 @@ describe('config', () => {
121
117
</div>
122
118
`
123
119
}
124
- const wrapper = mount ( testComponent )
120
+ const wrapper = mountingMethod ( testComponent )
125
121
expect ( wrapper . contains ( TransitionGroupStub ) ) . to . equal ( false )
126
122
expect ( wrapper . contains ( TransitionStub ) ) . to . equal ( false )
127
123
} )
0 commit comments