@@ -113,6 +113,22 @@ const root1 = {
113
113
childUIDs : [ ] ,
114
114
} ;
115
115
116
+ const groupMarker = {
117
+ type : TopicTypes . groupMarker ,
118
+ title : 'First Child Group Marker' ,
119
+ uid : 22 ,
120
+ parent : root0 . uid ,
121
+ depth : 1 ,
122
+ index : 4 ,
123
+ childUIDs : [ root0Child0 . uid , root0Child1 . uid ] ,
124
+ deprecatedChildrenCount : 0 ,
125
+ } ;
126
+
127
+ const root0WithGroupMarker = {
128
+ ...root0 ,
129
+ childUIDs : [ groupMarker . uid ] . concat ( root0 . childUIDs ) ,
130
+ } ;
131
+
116
132
const children = [
117
133
root0 ,
118
134
root0Child0 ,
@@ -121,6 +137,15 @@ const children = [
121
137
root1 ,
122
138
] ;
123
139
140
+ const childrenWithGroupMarker = [
141
+ root0WithGroupMarker ,
142
+ groupMarker ,
143
+ root0Child0 ,
144
+ root0Child1 ,
145
+ root0Child1GrandChild0 ,
146
+ root1 ,
147
+ ] ;
148
+
124
149
const activePath = [ root0 . path , root0Child0 . path ] ;
125
150
126
151
const defaultProps = {
@@ -550,6 +575,23 @@ describe('NavigatorCard', () => {
550
575
expect ( all . at ( 1 ) . props ( 'item' ) ) . toEqual ( root0Child1 ) ;
551
576
expect ( all . at ( 2 ) . props ( 'item' ) ) . toEqual ( root0Child1GrandChild0 ) ;
552
577
} ) ;
578
+
579
+ it ( 'keeps groupMarkers in mind, when `@toggle-full` is handled' , async ( ) => {
580
+ const wrapper = createWrapper ( {
581
+ propsData : {
582
+ // make sure no items are open
583
+ activePath : [ ] ,
584
+ children : childrenWithGroupMarker ,
585
+ } ,
586
+ } ) ;
587
+ await flushPromises ( ) ;
588
+ wrapper . find ( NavigatorCardItem ) . vm . $emit ( 'toggle-full' , root0 ) ;
589
+ await flushPromises ( ) ;
590
+ expect ( wrapper . findAll ( NavigatorCardItem ) ) . toHaveLength ( 6 ) ;
591
+ wrapper . find ( NavigatorCardItem ) . vm . $emit ( 'toggle-full' , root0 ) ;
592
+ await flushPromises ( ) ;
593
+ expect ( wrapper . findAll ( NavigatorCardItem ) ) . toHaveLength ( 2 ) ;
594
+ } ) ;
553
595
} ) ;
554
596
555
597
describe ( 'toggles all siblings on @toggle-siblings' , ( ) => {
@@ -1534,22 +1576,6 @@ describe('NavigatorCard', () => {
1534
1576
} ) ;
1535
1577
1536
1578
describe ( 'with groupMarker' , ( ) => {
1537
- const groupMarker = {
1538
- type : TopicTypes . groupMarker ,
1539
- title : 'First Child Group Marker' ,
1540
- uid : 22 ,
1541
- parent : root0 . uid ,
1542
- depth : 1 ,
1543
- index : 4 ,
1544
- childUIDs : [ root0Child0 . uid , root0Child1 . uid ] ,
1545
- deprecatedChildrenCount : 0 ,
1546
- } ;
1547
-
1548
- const root0Updated = {
1549
- ...root0 ,
1550
- childUIDs : [ groupMarker . uid ] . concat ( root0 . childUIDs ) ,
1551
- } ;
1552
-
1553
1579
it ( 'shows "Hide Deprecated" tag, if there are deprecated items' , async ( ) => {
1554
1580
const updatedChild = {
1555
1581
...root0Child0 ,
@@ -1559,7 +1585,8 @@ describe('NavigatorCard', () => {
1559
1585
const wrapper = createWrapper ( {
1560
1586
propsData : {
1561
1587
children : [
1562
- root0Updated , groupMarker , updatedChild , root0Child1 , root0Child1GrandChild0 , root1 ,
1588
+ root0WithGroupMarker , groupMarker , updatedChild , root0Child1 , root0Child1GrandChild0 ,
1589
+ root1 ,
1563
1590
] ,
1564
1591
activePath : [ root0 . path ] ,
1565
1592
} ,
@@ -1577,7 +1604,7 @@ describe('NavigatorCard', () => {
1577
1604
// assert the deprecated item is filtered out
1578
1605
expect ( allItems ) . toHaveLength ( 4 ) ;
1579
1606
// assert root is rendered
1580
- expect ( allItems . at ( 0 ) . props ( 'item' ) ) . toEqual ( root0Updated ) ;
1607
+ expect ( allItems . at ( 0 ) . props ( 'item' ) ) . toEqual ( root0WithGroupMarker ) ;
1581
1608
// assert the group marker is rendered
1582
1609
expect ( allItems . at ( 1 ) . props ( 'item' ) ) . toEqual ( groupMarker ) ;
1583
1610
// assert the none-deprecated child is rendered, but its not expanded
@@ -1592,7 +1619,7 @@ describe('NavigatorCard', () => {
1592
1619
allItems = wrapper . findAll ( NavigatorCardItem ) ;
1593
1620
// assert that filtering opens everything as usual, showing groupMarkers as well
1594
1621
expect ( allItems ) . toHaveLength ( 4 ) ;
1595
- expect ( allItems . at ( 0 ) . props ( 'item' ) ) . toEqual ( root0Updated ) ;
1622
+ expect ( allItems . at ( 0 ) . props ( 'item' ) ) . toEqual ( root0WithGroupMarker ) ;
1596
1623
expect ( allItems . at ( 1 ) . props ( 'item' ) ) . toEqual ( groupMarker ) ;
1597
1624
expect ( allItems . at ( 2 ) . props ( 'item' ) ) . toEqual ( root0Child1 ) ;
1598
1625
expect ( allItems . at ( 3 ) . props ( 'item' ) ) . toEqual ( root0Child1GrandChild0 ) ;
@@ -1602,7 +1629,8 @@ describe('NavigatorCard', () => {
1602
1629
const wrapper = createWrapper ( {
1603
1630
propsData : {
1604
1631
children : [
1605
- root0Updated , groupMarker , root0Child0 , root0Child1 , root0Child1GrandChild0 , root1 ,
1632
+ root0WithGroupMarker , groupMarker , root0Child0 , root0Child1 , root0Child1GrandChild0 ,
1633
+ root1 ,
1606
1634
] ,
1607
1635
activePath : [ root0 . path ] ,
1608
1636
} ,
@@ -1614,7 +1642,7 @@ describe('NavigatorCard', () => {
1614
1642
let items = wrapper . findAll ( NavigatorCardItem ) ;
1615
1643
// parent + group and 2 siblings
1616
1644
expect ( items ) . toHaveLength ( 4 ) ;
1617
- expect ( items . at ( 0 ) . props ( 'item' ) ) . toEqual ( root0Updated ) ;
1645
+ expect ( items . at ( 0 ) . props ( 'item' ) ) . toEqual ( root0WithGroupMarker ) ;
1618
1646
expect ( items . at ( 1 ) . props ( 'item' ) ) . toEqual ( groupMarker ) ;
1619
1647
expect ( items . at ( 2 ) . props ( 'item' ) ) . toEqual ( root0Child0 ) ;
1620
1648
expect ( items . at ( 3 ) . props ( 'item' ) ) . toEqual ( root0Child1 ) ;
@@ -1629,7 +1657,7 @@ describe('NavigatorCard', () => {
1629
1657
await flushPromises ( ) ;
1630
1658
items = wrapper . findAll ( NavigatorCardItem ) ;
1631
1659
expect ( items ) . toHaveLength ( 5 ) ;
1632
- expect ( items . at ( 0 ) . props ( 'item' ) ) . toEqual ( root0Updated ) ;
1660
+ expect ( items . at ( 0 ) . props ( 'item' ) ) . toEqual ( root0WithGroupMarker ) ;
1633
1661
expect ( items . at ( 1 ) . props ( 'item' ) ) . toEqual ( groupMarker ) ;
1634
1662
expect ( items . at ( 2 ) . props ( 'item' ) ) . toEqual ( root0Child0 ) ;
1635
1663
expect ( items . at ( 3 ) . props ( 'item' ) ) . toEqual ( root0Child1 ) ;
@@ -1642,7 +1670,7 @@ describe('NavigatorCard', () => {
1642
1670
const wrapper = createWrapper ( {
1643
1671
propsData : {
1644
1672
children : [
1645
- root0Updated , groupMarker , root0Child0Clone ,
1673
+ root0WithGroupMarker , groupMarker , root0Child0Clone ,
1646
1674
root0Child1Clone , root0Child1GrandChild0 , root1 ,
1647
1675
] ,
1648
1676
activePath : [ root0 . path ] ,
@@ -1656,7 +1684,7 @@ describe('NavigatorCard', () => {
1656
1684
const items = wrapper . findAll ( NavigatorCardItem ) ;
1657
1685
// parent + group and 1 item
1658
1686
expect ( items ) . toHaveLength ( 3 ) ;
1659
- expect ( items . at ( 0 ) . props ( 'item' ) ) . toEqual ( root0Updated ) ;
1687
+ expect ( items . at ( 0 ) . props ( 'item' ) ) . toEqual ( root0WithGroupMarker ) ;
1660
1688
expect ( items . at ( 1 ) . props ( 'item' ) ) . toEqual ( groupMarker ) ;
1661
1689
expect ( items . at ( 2 ) . props ( 'item' ) ) . toEqual ( root0Child1Clone ) ;
1662
1690
} ) ;
@@ -1674,7 +1702,7 @@ describe('NavigatorCard', () => {
1674
1702
childUIDs : [ ] ,
1675
1703
} ;
1676
1704
const groupMarkerClone = { ...groupMarker , deprecatedChildrenCount : 2 } ;
1677
- const root0Clone = { ...root0Updated , deprecated : true } ;
1705
+ const root0Clone = { ...root0WithGroupMarker , deprecated : true } ;
1678
1706
const wrapper = createWrapper ( {
1679
1707
propsData : {
1680
1708
children : [
@@ -1713,15 +1741,6 @@ describe('NavigatorCard', () => {
1713
1741
...root0Child0 ,
1714
1742
deprecated : true ,
1715
1743
} ;
1716
- const groupMarker = {
1717
- type : TopicTypes . groupMarker ,
1718
- title : 'First Child Group Marker' ,
1719
- uid : 22 ,
1720
- parent : root0 . uid ,
1721
- depth : 1 ,
1722
- index : 4 ,
1723
- childUIDs : [ ] ,
1724
- } ;
1725
1744
const root0Updated = {
1726
1745
...root0 ,
1727
1746
childUIDs : root0 . childUIDs . concat ( groupMarker . uid ) ,
0 commit comments