@@ -10,15 +10,17 @@ import { describeRunIf, itDoNotRunIf, itSkipIf } from 'conditional-specs'
10
10
import Vuex from 'vuex'
11
11
12
12
describeRunIf ( process . env . TEST_ENV !== 'node' , 'mount' , ( ) => {
13
+ const sandbox = sinon . createSandbox ( )
13
14
const windowSave = window
14
15
15
16
beforeEach ( ( ) => {
16
- sinon . stub ( console , 'error' ) . callThrough ( )
17
+ sandbox . stub ( console , 'error' ) . callThrough ( )
17
18
} )
18
19
19
20
afterEach ( ( ) => {
20
21
window = windowSave // eslint-disable-line no-native-reassign
21
- console . error . restore ( )
22
+ sandbox . reset ( )
23
+ sandbox . restore ( )
22
24
} )
23
25
24
26
it ( 'returns new VueWrapper with mounted Vue instance if no options are passed' , ( ) => {
@@ -101,7 +103,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'mount', () => {
101
103
'handles extended components added to Vue constructor' ,
102
104
( ) => {
103
105
const ChildComponent = Vue . extend ( {
104
- template : '<div />' ,
106
+ render : h => h ( 'div' ) ,
105
107
mounted ( ) {
106
108
this . $route . params
107
109
}
@@ -126,10 +128,11 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'mount', () => {
126
128
)
127
129
128
130
it ( 'does not use cached component' , ( ) => {
129
- ComponentWithMixin . methods . someMethod = sinon . stub ( )
131
+ sandbox . stub ( ComponentWithMixin . methods , 'someMethod' )
130
132
mount ( ComponentWithMixin )
131
133
expect ( ComponentWithMixin . methods . someMethod . callCount ) . to . equal ( 1 )
132
- ComponentWithMixin . methods . someMethod = sinon . stub ( )
134
+ ComponentWithMixin . methods . someMethod . restore ( )
135
+ sandbox . stub ( ComponentWithMixin . methods , 'someMethod' )
133
136
mount ( ComponentWithMixin )
134
137
expect ( ComponentWithMixin . methods . someMethod . callCount ) . to . equal ( 1 )
135
138
} )
@@ -138,7 +141,6 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'mount', () => {
138
141
if (
139
142
! ( navigator . userAgent . includes && navigator . userAgent . includes ( 'node.js' ) )
140
143
) {
141
- console . log ( 'window read only. skipping test ...' )
142
144
return
143
145
}
144
146
@@ -160,7 +162,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'mount', () => {
160
162
} )
161
163
162
164
itDoNotRunIf ( vueVersion < 2.3 , 'overrides methods' , ( ) => {
163
- const stub = sinon . stub ( )
165
+ const stub = sandbox . stub ( )
164
166
const TestComponent = Vue . extend ( {
165
167
template : '<div />' ,
166
168
methods : {
@@ -179,8 +181,8 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'mount', () => {
179
181
} )
180
182
181
183
it . skip ( 'overrides component prototype' , ( ) => {
182
- const mountSpy = sinon . spy ( )
183
- const destroySpy = sinon . spy ( )
184
+ const mountSpy = sandbox . spy ( )
185
+ const destroySpy = sandbox . spy ( )
184
186
const Component = Vue . extend ( { } )
185
187
const {
186
188
$mount : originalMount ,
@@ -233,7 +235,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'mount', () => {
233
235
it ( 'deletes mounting options before passing options to component' , ( ) => {
234
236
const wrapper = mount (
235
237
{
236
- render : h => h ( 'div' )
238
+ template : '<div />'
237
239
} ,
238
240
{
239
241
provide : {
@@ -248,7 +250,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'mount', () => {
248
250
} ,
249
251
localVue : createLocalVue ( ) ,
250
252
stubs : {
251
- prop : 'val'
253
+ prop : { template : '<div />' }
252
254
} ,
253
255
attrs : {
254
256
prop : 'val'
0 commit comments