@@ -13,7 +13,6 @@ import { describeRunIf, itDoNotRunIf } from 'conditional-specs'
1313
1414describeRunIf ( process . env . TEST_ENV !== 'node' , 'shallowMount' , ( ) => {
1515 const sandbox = sinon . createSandbox ( )
16- const htmlOptions = { prettyPrint : false }
1716
1817 beforeEach ( ( ) => {
1918 sandbox . stub ( console , 'info' ) . callThrough ( )
@@ -71,7 +70,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
7170 const wrapper = shallowMount ( TestComponent , {
7271 localVue
7372 } )
74- expect ( wrapper . html ( htmlOptions ) ) . to . equal ( '<child-stub>Hello</child-stub>' )
73+ expect ( wrapper . html ( ) ) . to . equal ( '<child-stub>Hello</child-stub>' )
7574 } )
7675
7776 it ( 'renders named slots' , ( ) => {
@@ -90,8 +89,11 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
9089 const wrapper = shallowMount ( TestComponent , {
9190 localVue
9291 } )
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>'
9597 )
9698 } )
9799
@@ -101,7 +103,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
101103 components : { Child : { } }
102104 }
103105 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>' )
105107 } )
106108
107109 it ( 'renders children for functional components' , ( ) => {
@@ -116,7 +118,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
116118 const wrapper = shallowMount ( TestComponent , {
117119 localVue
118120 } )
119- expect ( wrapper . html ( htmlOptions ) ) . to . equal ( '<child-stub>Hello</child-stub>' )
121+ expect ( wrapper . html ( ) ) . to . equal ( '<child-stub>Hello</child-stub>' )
120122 } )
121123
122124 it ( 'stubs globally registered components' , ( ) => {
@@ -172,9 +174,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
172174 }
173175 }
174176 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"' )
178178 }
179179 )
180180
@@ -192,7 +192,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
192192 }
193193 }
194194 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"' )
196196 }
197197 )
198198
@@ -210,9 +210,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
210210 }
211211 }
212212 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"' )
216214 } )
217215
218216 it ( 'renders classes for functional components' , ( ) => {
@@ -229,7 +227,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
229227 components
230228 }
231229 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"' )
233231 const TestComponent2 = {
234232 template : `<child :class="classA"/>` ,
235233 data : ( ) => ( {
@@ -238,7 +236,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
238236 components
239237 }
240238 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"' )
242240 const TestComponent3 = {
243241 template : `<child class="b" />` ,
244242 data : ( ) => ( {
@@ -247,7 +245,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
247245 components
248246 }
249247 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"' )
251249 } )
252250
253251 itDoNotRunIf ( vueVersion < 2.1 , 'handles recursive components' , ( ) => {
@@ -260,7 +258,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
260258 name : 'test-component'
261259 }
262260 const wrapper = shallowMount ( TestComponent )
263- expect ( wrapper . html ( htmlOptions ) ) . to . contain ( '<test-component-stub>' )
261+ expect ( wrapper . html ( ) ) . to . contain ( '<test-component-stub>' )
264262 expect ( console . error ) . not . calledWith ( '[Vue warn]' )
265263 } )
266264
@@ -427,9 +425,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
427425 }
428426 const wrapper = shallowMount ( TestComponent )
429427
430- expect ( wrapper . html ( htmlOptions ) ) . to . equal (
431- '<custom-element></custom-element>'
432- )
428+ expect ( wrapper . html ( ) ) . to . equal ( '<custom-element></custom-element>' )
433429 } )
434430
435431 it ( 'stubs lazily registered components' , ( ) => {
@@ -476,7 +472,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
476472
477473 localVue . use ( myPlugin )
478474 const wrapper = shallowMount ( TestComponent , { localVue } )
479- expect ( wrapper . html ( htmlOptions ) ) . to . contain ( 'registered-component-stub' )
475+ expect ( wrapper . html ( ) ) . to . contain ( 'registered-component-stub' )
480476 } )
481477
482478 it ( 'throws an error when the component fails to mount' , ( ) => {
@@ -524,12 +520,12 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
524520 }
525521 }
526522 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 ' +
533529 '</div>'
534530 )
535531 } )
0 commit comments