@@ -13,8 +13,6 @@ import { describeRunIf, itDoNotRunIf } from 'conditional-specs'
13
13
14
14
describeRunIf ( process . env . TEST_ENV !== 'node' , 'shallowMount' , ( ) => {
15
15
const sandbox = sinon . createSandbox ( )
16
- const htmlOptions = { prettyPrint : false }
17
-
18
16
beforeEach ( ( ) => {
19
17
sandbox . stub ( console , 'info' ) . callThrough ( )
20
18
sandbox . stub ( console , 'error' ) . callThrough ( )
@@ -71,7 +69,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
71
69
const wrapper = shallowMount ( TestComponent , {
72
70
localVue
73
71
} )
74
- expect ( wrapper . html ( htmlOptions ) ) . to . equal ( '<child-stub>Hello</child-stub>' )
72
+ expect ( wrapper . html ( ) ) . to . equal ( '<child-stub>Hello</child-stub>' )
75
73
} )
76
74
77
75
it ( 'renders named slots' , ( ) => {
@@ -90,8 +88,11 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
90
88
const wrapper = shallowMount ( TestComponent , {
91
89
localVue
92
90
} )
93
- expect ( wrapper . html ( htmlOptions ) ) . to . equal (
94
- '<child-stub><p>Hello</p> <p>World</p></child-stub>'
91
+ expect ( wrapper . html ( ) ) . to . equal (
92
+ '<child-stub>\n' +
93
+ ' <p>Hello</p>\n' +
94
+ ' <p>World</p>\n' +
95
+ '</child-stub>'
95
96
)
96
97
} )
97
98
@@ -101,7 +102,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
101
102
components : { Child : { } }
102
103
}
103
104
const wrapper = shallowMount ( TestComponent )
104
- expect ( wrapper . html ( htmlOptions ) ) . to . equal ( '<child-stub></child-stub>' )
105
+ expect ( wrapper . html ( ) ) . to . equal ( '<child-stub></child-stub>' )
105
106
} )
106
107
107
108
it ( 'renders children for functional components' , ( ) => {
@@ -116,7 +117,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
116
117
const wrapper = shallowMount ( TestComponent , {
117
118
localVue
118
119
} )
119
- expect ( wrapper . html ( htmlOptions ) ) . to . equal ( '<child-stub>Hello</child-stub>' )
120
+ expect ( wrapper . html ( ) ) . to . equal ( '<child-stub>Hello</child-stub>' )
120
121
} )
121
122
122
123
it ( 'stubs globally registered components' , ( ) => {
@@ -172,9 +173,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
172
173
}
173
174
}
174
175
const wrapper = shallowMount ( TestComponent )
175
- expect ( wrapper . html ( htmlOptions ) ) . to . contain (
176
- '<child-stub prop="a" attr="hello"'
177
- )
176
+ expect ( wrapper . html ( ) ) . to . contain ( '<child-stub prop="a" attr="hello"' )
178
177
}
179
178
)
180
179
@@ -192,7 +191,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
192
191
}
193
192
}
194
193
const wrapper = shallowMount ( TestComponent )
195
- expect ( wrapper . html ( htmlOptions ) ) . to . contain ( '<child-stub class="b a"' )
194
+ expect ( wrapper . html ( ) ) . to . contain ( '<child-stub class="b a"' )
196
195
}
197
196
)
198
197
@@ -210,9 +209,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
210
209
}
211
210
}
212
211
const wrapper = shallowMount ( TestComponent )
213
- expect ( wrapper . html ( htmlOptions ) ) . to . contain (
214
- '<child-stub prop="a" attr="hello"'
215
- )
212
+ expect ( wrapper . html ( ) ) . to . contain ( '<child-stub prop="a" attr="hello"' )
216
213
} )
217
214
218
215
it ( 'renders classes for functional components' , ( ) => {
@@ -229,7 +226,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
229
226
components
230
227
}
231
228
const wrapper = shallowMount ( TestComponent )
232
- expect ( wrapper . html ( htmlOptions ) ) . to . contain ( '<child-stub class="b a"' )
229
+ expect ( wrapper . html ( ) ) . to . contain ( '<child-stub class="b a"' )
233
230
const TestComponent2 = {
234
231
template : `<child :class="classA"/>` ,
235
232
data : ( ) => ( {
@@ -238,7 +235,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
238
235
components
239
236
}
240
237
const wrapper2 = shallowMount ( TestComponent2 )
241
- expect ( wrapper2 . html ( htmlOptions ) ) . to . contain ( '<child-stub class="a"' )
238
+ expect ( wrapper2 . html ( ) ) . to . contain ( '<child-stub class="a"' )
242
239
const TestComponent3 = {
243
240
template : `<child class="b" />` ,
244
241
data : ( ) => ( {
@@ -247,7 +244,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
247
244
components
248
245
}
249
246
const wrapper3 = shallowMount ( TestComponent3 )
250
- expect ( wrapper3 . html ( htmlOptions ) ) . to . contain ( '<child-stub class="b"' )
247
+ expect ( wrapper3 . html ( ) ) . to . contain ( '<child-stub class="b"' )
251
248
} )
252
249
253
250
itDoNotRunIf ( vueVersion < 2.1 , 'handles recursive components' , ( ) => {
@@ -260,7 +257,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
260
257
name : 'test-component'
261
258
}
262
259
const wrapper = shallowMount ( TestComponent )
263
- expect ( wrapper . html ( htmlOptions ) ) . to . contain ( '<test-component-stub>' )
260
+ expect ( wrapper . html ( ) ) . to . contain ( '<test-component-stub>' )
264
261
expect ( console . error ) . not . calledWith ( '[Vue warn]' )
265
262
} )
266
263
@@ -427,9 +424,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
427
424
}
428
425
const wrapper = shallowMount ( TestComponent )
429
426
430
- expect ( wrapper . html ( htmlOptions ) ) . to . equal (
431
- '<custom-element></custom-element>'
432
- )
427
+ expect ( wrapper . html ( ) ) . to . equal ( '<custom-element></custom-element>' )
433
428
} )
434
429
435
430
it ( 'stubs lazily registered components' , ( ) => {
@@ -476,7 +471,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
476
471
477
472
localVue . use ( myPlugin )
478
473
const wrapper = shallowMount ( TestComponent , { localVue } )
479
- expect ( wrapper . html ( htmlOptions ) ) . to . contain ( 'registered-component-stub' )
474
+ expect ( wrapper . html ( ) ) . to . contain ( 'registered-component-stub' )
480
475
} )
481
476
482
477
it ( 'throws an error when the component fails to mount' , ( ) => {
@@ -524,12 +519,12 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
524
519
}
525
520
}
526
521
const wrapper = shallowMount ( TestComponent )
527
- expect ( wrapper . html ( htmlOptions ) ) . to . equal (
528
- '<div>' +
529
- '<childcomponent-stub></childcomponent-stub> ' +
530
- '<anonymous-stub></anonymous-stub> ' +
531
- '<anonymous-stub></anonymous-stub> ' +
532
- '<anonymous-stub></anonymous-stub>' +
522
+ expect ( wrapper . html ( ) ) . to . equal (
523
+ '<div>\n ' +
524
+ ' <childcomponent-stub></childcomponent-stub>\n ' +
525
+ ' <anonymous-stub></anonymous-stub>\n ' +
526
+ ' <anonymous-stub></anonymous-stub>\n ' +
527
+ ' <anonymous-stub></anonymous-stub>\n ' +
533
528
'</div>'
534
529
)
535
530
} )
0 commit comments