@@ -104,11 +104,7 @@ describe('createStubs', () => {
104104 }
105105
106106 const Parent = {
107- render : ( ) => h ( 'div' , [
108- h ( Child1 ) ,
109- h ( Child1 ) ,
110- h ( Child2 )
111- ] )
107+ render : ( ) => h ( 'div' , [ h ( Child1 ) , h ( Child1 ) , h ( Child2 ) ] )
112108 }
113109
114110 const customCreateStub = jest . fn ( ( { name } ) => h ( `${ name } -custom-stub` ) )
@@ -129,15 +125,23 @@ describe('createStubs', () => {
129125 shallow : true
130126 } )
131127
132- expect ( wrapper . html ( ) ) . toBe ( '<div>\n' +
133- ' <child1-custom-stub></child1-custom-stub>\n' +
134- ' <child1-custom-stub></child1-custom-stub>\n' +
135- ' <child2-custom-stub></child2-custom-stub>\n' +
136- '</div>' )
128+ expect ( wrapper . html ( ) ) . toBe (
129+ '<div>\n' +
130+ ' <child1-custom-stub></child1-custom-stub>\n' +
131+ ' <child1-custom-stub></child1-custom-stub>\n' +
132+ ' <child2-custom-stub></child2-custom-stub>\n' +
133+ '</div>'
134+ )
137135
138136 expect ( customCreateStub ) . toHaveBeenCalledTimes ( 2 )
139- expect ( customCreateStub ) . toHaveBeenCalledWith ( { name : 'child1' , component : Child1 } )
140- expect ( customCreateStub ) . toHaveBeenCalledWith ( { name : 'child2' , component : Child2 } )
137+ expect ( customCreateStub ) . toHaveBeenCalledWith ( {
138+ name : 'child1' ,
139+ component : Child1
140+ } )
141+ expect ( customCreateStub ) . toHaveBeenCalledWith ( {
142+ name : 'child2' ,
143+ component : Child2
144+ } )
141145 } )
142146
143147 it ( 'should be called only for stubbed components' , ( ) => {
@@ -149,24 +153,31 @@ describe('createStubs', () => {
149153 }
150154 } )
151155
152- expect ( wrapper . html ( ) ) . toBe ( '<div>\n' +
153- ' <div>real child 1</div>\n' +
154- ' <div>real child 1</div>\n' +
155- ' <child2-custom-stub></child2-custom-stub>\n' +
156- '</div>' )
156+ expect ( wrapper . html ( ) ) . toBe (
157+ '<div>\n' +
158+ ' <div>real child 1</div>\n' +
159+ ' <div>real child 1</div>\n' +
160+ ' <child2-custom-stub></child2-custom-stub>\n' +
161+ '</div>'
162+ )
157163
158164 expect ( customCreateStub ) . toHaveBeenCalledTimes ( 1 )
159- expect ( customCreateStub ) . toHaveBeenCalledWith ( { name : 'child2' , component : Child2 } )
165+ expect ( customCreateStub ) . toHaveBeenCalledWith ( {
166+ name : 'child2' ,
167+ component : Child2
168+ } )
160169 } )
161170
162171 it ( 'should not be called for no stubs' , ( ) => {
163172 const wrapper = mount ( Parent )
164173
165- expect ( wrapper . html ( ) ) . toBe ( '<div>\n' +
166- ' <div>real child 1</div>\n' +
167- ' <div>real child 1</div>\n' +
168- ' <div>real child 2</div>\n' +
169- '</div>' )
174+ expect ( wrapper . html ( ) ) . toBe (
175+ '<div>\n' +
176+ ' <div>real child 1</div>\n' +
177+ ' <div>real child 1</div>\n' +
178+ ' <div>real child 2</div>\n' +
179+ '</div>'
180+ )
170181
171182 expect ( customCreateStub ) . not . toHaveBeenCalled ( )
172183 } )
@@ -181,13 +192,18 @@ describe('createStubs', () => {
181192 }
182193 } )
183194
184- expect ( wrapper . html ( ) ) . toBe ( '<div>\n' +
185- ' <child1-custom-stub></child1-custom-stub>\n' +
186- ' <child1-custom-stub></child1-custom-stub>\n' +
187- ' <div>Child 2 stub</div>\n' +
188- '</div>' )
195+ expect ( wrapper . html ( ) ) . toBe (
196+ '<div>\n' +
197+ ' <child1-custom-stub></child1-custom-stub>\n' +
198+ ' <child1-custom-stub></child1-custom-stub>\n' +
199+ ' <div>Child 2 stub</div>\n' +
200+ '</div>'
201+ )
189202
190203 expect ( customCreateStub ) . toHaveBeenCalledTimes ( 1 )
191- expect ( customCreateStub ) . toHaveBeenCalledWith ( { name : 'child1' , component : Child1 } )
204+ expect ( customCreateStub ) . toHaveBeenCalledWith ( {
205+ name : 'child1' ,
206+ component : Child1
207+ } )
192208 } )
193209} )
0 commit comments