@@ -83,7 +83,7 @@ describe('component props (vapor)', () => {
8383 let props : any
8484 // TODO: attrs
8585
86- const Comp : FunctionalComponent = ( _props ) => {
86+ const Comp : FunctionalComponent = _props => {
8787 const instance = getCurrentInstance ( ) !
8888 props = instance . props
8989 return { }
@@ -121,7 +121,7 @@ describe('component props (vapor)', () => {
121121 let props : any
122122 // TODO: attrs
123123
124- const Comp : FunctionalComponent = ( _props ) => {
124+ const Comp : FunctionalComponent = _props => {
125125 const instance = getCurrentInstance ( ) !
126126 props = instance . props
127127 return { }
@@ -186,7 +186,10 @@ describe('component props (vapor)', () => {
186186
187187 test ( 'default value' , ( ) => {
188188 let props : any
189- const defaultFn = vi . fn ( ( ) => ( { a : 1 } ) )
189+ const defaultFn = vi . fn ( ( ) => {
190+ console . trace ( )
191+ return { a : 1 }
192+ } )
190193 const defaultBaz = vi . fn ( ( ) => ( { b : 1 } ) )
191194
192195 const Comp = {
@@ -218,10 +221,12 @@ describe('component props (vapor)', () => {
218221 host ,
219222 )
220223 expect ( props . foo ) . toBe ( 2 )
221- const prevBar = props . bar
222- // expect(props.bar).toEqual({ a: 1 }) // FIXME: failed
224+ // const prevBar = props.bar
225+ props . bar
226+ expect ( props . bar ) . toEqual ( { a : 1 } )
223227 expect ( props . baz ) . toEqual ( defaultBaz )
224- // expect(defaultFn).toHaveBeenCalledTimes(1) // FIXME: failed
228+ // expect(defaultFn).toHaveBeenCalledTimes(1) // failed: (caching is not supported)
229+ expect ( defaultFn ) . toHaveBeenCalledTimes ( 2 )
225230 expect ( defaultBaz ) . toHaveBeenCalledTimes ( 0 )
226231
227232 // #999: updates should not cause default factory of unchanged prop to be
@@ -236,9 +241,9 @@ describe('component props (vapor)', () => {
236241 host ,
237242 )
238243 expect ( props . foo ) . toBe ( 3 )
239- // expect(props.bar).toEqual({ a: 1 }) // FIXME: failed
240- expect ( props . bar ) . toBe ( prevBar )
241- // expect(defaultFn).toHaveBeenCalledTimes(1) // FIXME: failed
244+ expect ( props . bar ) . toEqual ( { a : 1 } )
245+ // expect(props.bar).toBe(prevBar) // failed: (caching is not supported )
246+ // expect(defaultFn).toHaveBeenCalledTimes(1) // failed: caching is not supported (called 3 times)
242247
243248 render (
244249 Comp as any ,
@@ -251,7 +256,7 @@ describe('component props (vapor)', () => {
251256 )
252257 expect ( props . foo ) . toBe ( 1 )
253258 expect ( props . bar ) . toEqual ( { b : 2 } )
254- // expect(defaultFn).toHaveBeenCalledTimes(1) // FIXME: failed
259+ // expect(defaultFn).toHaveBeenCalledTimes(1) // failed: caching is not supported (called 3 times)
255260
256261 render (
257262 Comp as any ,
@@ -267,7 +272,7 @@ describe('component props (vapor)', () => {
267272 )
268273 expect ( props . foo ) . toBe ( 3 )
269274 expect ( props . bar ) . toEqual ( { b : 3 } )
270- // expect(defaultFn).toHaveBeenCalledTimes(1) // FIXME: failed
275+ // expect(defaultFn).toHaveBeenCalledTimes(1) // failed: caching is not supported (called 3 times)
271276
272277 render (
273278 Comp as any ,
@@ -280,7 +285,7 @@ describe('component props (vapor)', () => {
280285 )
281286 expect ( props . foo ) . toBe ( 1 )
282287 expect ( props . bar ) . toEqual ( { b : 4 } )
283- // expect(defaultFn).toHaveBeenCalledTimes(1) // FIXME: failed
288+ // expect(defaultFn).toHaveBeenCalledTimes(1) // failed: caching is not supported (called 3 times)
284289 } )
285290
286291 test ( 'using inject in default value factory' , ( ) => {
0 commit comments