@@ -240,29 +240,25 @@ describe('data grouping', () => {
240240 test ( 'computes total counts correctly' , ( ) => {
241241 const expandable = renderUseCollection ( items , { expandableRows : { getId, getParentId } } ) ;
242242 expect ( expandable . result . collectionProps . totalItemsCount ) . toBe ( 3 ) ;
243+ expect ( expandable . result . collectionProps . expandableRows ! . getItemsCount ) . toBe ( undefined ) ;
243244
244245 const grouped = renderUseCollection ( items , { expandableRows : { getId, getParentId, dataGrouping : true } } ) ;
245- expect ( grouped . result . collectionProps . totalItemsCount ) . toBe ( 6 ) ;
246+ expect ( grouped . result . collectionProps . totalItemsCount ) . toBe ( 3 ) ;
247+ expect ( grouped . result . collectionProps . expandableRows ! . getItemsCount ! ( null ) ) . toBe ( 6 ) ;
246248 } ) ;
247249
248250 test ( 'computes total selected counts correctly' , ( ) => {
249251 const expandable = renderUseCollection ( items , {
250252 expandableRows : { getId, getParentId } ,
251253 selection : { defaultSelectedItems : [ { id : 'a' } , { id : 'a.1.1' } ] , keepSelection : true } ,
252254 } ) ;
253- expect ( expandable . result . collectionProps . totalSelectedItemsCount ) . toBe ( 2 ) ;
255+ expect ( expandable . result . collectionProps . expandableRows ! . getSelectedItemsCount ) . toBe ( undefined ) ;
254256
255257 const grouped = renderUseCollection ( items , {
256258 expandableRows : { getId, getParentId, dataGrouping : true } ,
257259 selection : { defaultSelectedItems : [ { id : 'a' } , { id : 'a.1.1' } ] , keepSelection : true } ,
258260 } ) ;
259- expect ( grouped . result . collectionProps . totalSelectedItemsCount ) . toBe ( 1 ) ;
260- } ) ;
261-
262- test ( 'does not return per-item counts when dataGrouping=undefined' , ( ) => {
263- const { result } = renderUseCollection ( items , { expandableRows : { getId, getParentId } , selection : { } } ) ;
264- expect ( result . collectionProps . expandableRows ! . getItemsCount ) . toBe ( undefined ) ;
265- expect ( result . collectionProps . expandableRows ! . getSelectedItemsCount ) . toBe ( undefined ) ;
261+ expect ( grouped . result . collectionProps . expandableRows ! . getSelectedItemsCount ! ( null ) ) . toBe ( 1 ) ;
266262 } ) ;
267263
268264 test ( 'can call selection counts on missing items' , ( ) => {
@@ -297,7 +293,7 @@ describe('data grouping', () => {
297293 } ) ;
298294 const expandableRows = result . collectionProps . expandableRows ! ;
299295 const sumCounts = result . items . reduce ( ( sum , i ) => sum + expandableRows . getItemsCount ! ( i ) , 0 ) ;
300- expect ( sumCounts ) . toBe ( result . collectionProps . totalItemsCount ) ;
296+ expect ( sumCounts ) . toBe ( result . collectionProps . expandableRows ! . getItemsCount ! ( null ) ) ;
301297 }
302298 } ) ;
303299
0 commit comments