@@ -74,7 +74,7 @@ describe(
7474
7575 function factoryQuery <
7676 AppModelType = DocumentData ,
77- DbModelType extends DocumentData = DocumentData
77+ DbModelType extends DocumentData = DocumentData ,
7878 > ( {
7979 options,
8080 ref,
@@ -358,8 +358,8 @@ describe(
358358 showFinished . value
359359 ? finishedListRef
360360 : showFinished . value === false
361- ? unfinishedListRef
362- : null
361+ ? unfinishedListRef
362+ : null
363363 )
364364 await addDoc ( listRef , { text : 'task 1' , finished : false } )
365365 await addDoc ( listRef , { text : 'task 2' , finished : false } )
@@ -398,6 +398,31 @@ describe(
398398 expect ( data . value ) . toContainEqual ( { text : 'task 3' , finished : true } )
399399 } )
400400
401+ it ( 'can be bound to a getter' , async ( ) => {
402+ const listCollectionRef = collection < { name : string } > (
403+ 'populatedCollection'
404+ )
405+ const collectionName = ref ( 'populatedCollection' )
406+
407+ const { wrapper, promise } = factory ( {
408+ ref : ( ) => collection ( collectionName . value ) ,
409+ } )
410+
411+ await promise . value
412+ await addDoc ( listCollectionRef , { name : 'a' } )
413+ await addDoc ( listCollectionRef , { name : 'b' } )
414+
415+ expect ( wrapper . vm . list ) . toHaveLength ( 2 )
416+ expect ( wrapper . vm . list ) . toContainEqual ( { name : 'a' } )
417+ expect ( wrapper . vm . list ) . toContainEqual ( { name : 'b' } )
418+
419+ collectionName . value = 'emptyCollection'
420+ await nextTick ( )
421+ await promise . value
422+ await nextTick ( )
423+ expect ( wrapper . vm . list ) . toHaveLength ( 0 )
424+ } )
425+
401426 it ( 'can be bound to a null ref' , async ( ) => {
402427 const { showFinished, listToDisplay } = await createFilteredLists ( )
403428 showFinished . value = null
0 commit comments