File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
packages/table-core/tests Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -767,5 +767,24 @@ describe('RowSelection', () => {
767767 const firstRow = table . getCoreRowModel ( ) . rows [ 0 ]
768768 expect ( firstRow . getIsAllSubRowsSelected ( ) ) . toBe ( true )
769769 } )
770+
771+ it ( 'should return true when all selectable sub-rows are selected and some are non-selectable' , ( ) => {
772+ const data = makeData ( 1 , 2 )
773+ const columns = generateColumns ( data )
774+
775+ const table = createTable < Person > ( {
776+ enableRowSelection : ( row ) => row . id !== '0.1' , // second sub-row is NOT selectable
777+ onStateChange ( ) { } ,
778+ renderFallbackValue : '' ,
779+ data,
780+ getSubRows : ( row ) => row . subRows ,
781+ state : { rowSelection : { '0.0' : true } } , // only selectable sub-row selected
782+ columns,
783+ getCoreRowModel : getCoreRowModel ( ) ,
784+ } )
785+
786+ const firstRow = table . getCoreRowModel ( ) . rows [ 0 ]
787+ expect ( firstRow . getIsAllSubRowsSelected ( ) ) . toBe ( true )
788+ } )
770789 } ) ;
771790} )
You can’t perform that action at this time.
0 commit comments