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