@@ -860,6 +860,56 @@ describe('NavigatorCard', () => {
860
860
expect ( allItems . at ( 3 ) . props ( 'item' ) ) . toEqual ( root1WithChildren ) ;
861
861
expect ( allItems . at ( 4 ) . props ( 'item' ) ) . toEqual ( root1Child0 ) ;
862
862
} ) ;
863
+
864
+ it ( 'toggles siblings properly, even when there are groupMarkers' , async ( ) => {
865
+ const wrapper = createWrapper ( {
866
+ propsData : {
867
+ children : [
868
+ root0WithGroupMarker ,
869
+ groupMarker ,
870
+ root0Child0WithChildren ,
871
+ root0Child0WithChildrenGrandChild0 ,
872
+ root0Child1 ,
873
+ root0Child1GrandChild0 ,
874
+ root1WithChildren ,
875
+ root1Child0 ,
876
+ ] ,
877
+ activePath : [ root0WithGroupMarker . path ] ,
878
+ } ,
879
+ } ) ;
880
+ await flushPromises ( ) ;
881
+ // assert we have 3 items rendered
882
+ expect ( wrapper . findAll ( NavigatorCardItem ) ) . toHaveLength ( 5 ) ;
883
+ // open the item and it's siblings
884
+ wrapper . find ( NavigatorCardItem ) . vm . $emit ( 'toggle-siblings' , root0Child1 ) ;
885
+ await flushPromises ( ) ;
886
+ // assert we have one extra item visible
887
+ let allItems = wrapper . findAll ( NavigatorCardItem ) ;
888
+ // assert all items are as we expect them to be
889
+ expect ( allItems ) . toHaveLength ( 7 ) ;
890
+ expect ( allItems . at ( 0 ) . props ( 'item' ) ) . toEqual ( root0WithGroupMarker ) ;
891
+ expect ( allItems . at ( 1 ) . props ( 'item' ) ) . toEqual ( groupMarker ) ;
892
+ expect ( allItems . at ( 2 ) . props ( 'item' ) ) . toEqual ( root0Child0WithChildren ) ;
893
+ expect ( allItems . at ( 3 ) . props ( 'item' ) ) . toEqual ( root0Child0WithChildrenGrandChild0 ) ;
894
+ expect ( allItems . at ( 4 ) . props ( 'item' ) ) . toEqual ( root0Child1 ) ;
895
+ expect ( allItems . at ( 5 ) . props ( 'item' ) ) . toEqual ( root0Child1GrandChild0 ) ;
896
+ expect ( allItems . at ( 6 ) . props ( 'item' ) ) . toEqual ( root1WithChildren ) ;
897
+
898
+ // toggle the items
899
+ allItems . at ( 0 ) . vm . $emit ( 'toggle-siblings' , root0Child1 ) ;
900
+ await flushPromises ( ) ;
901
+ allItems = wrapper . findAll ( NavigatorCardItem ) ;
902
+ expect ( allItems ) . toHaveLength ( 5 ) ;
903
+ expect ( allItems . at ( 0 ) . props ( ) ) . toMatchObject ( {
904
+ item : root0WithGroupMarker ,
905
+ expanded : true ,
906
+ } ) ;
907
+ expect ( allItems . at ( 1 ) . props ( 'item' ) ) . toEqual ( groupMarker ) ;
908
+ expect ( allItems . at ( 2 ) . props ( ) )
909
+ . toMatchObject ( { item : root0Child0WithChildren , expanded : false } ) ;
910
+ expect ( allItems . at ( 3 ) . props ( ) ) . toMatchObject ( { item : root0Child1 , expanded : false } ) ;
911
+ expect ( allItems . at ( 4 ) . props ( ) ) . toMatchObject ( { item : root1WithChildren , expanded : false } ) ;
912
+ } ) ;
863
913
} ) ;
864
914
865
915
describe ( 'on @focus-parent' , ( ) => {
0 commit comments