Skip to content

Commit

Permalink
Add failing test showing row is selected with no selectable subRows
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel 'Aaron' Cohen committed Nov 4, 2024
1 parent 6b4d616 commit 82ee099
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/table-core/tests/RowSelection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,34 @@ describe('RowSelection', () => {
expect(result).toEqual(false)
})

it('should return false if no sub-rows are selectable', () => {
const data = makeData(3, 2)
const columns = generateColumns(data)

const table = createTable<Person>({
enableRowSelection: false,
onStateChange() {},
renderFallbackValue: '',
data,
getSubRows: row => row.subRows,
state: {
rowSelection: {},
},
columns,
getCoreRowModel: getCoreRowModel(),
})

const firstRow = table.getCoreRowModel().rows[0]

const result = RowSelection.isSubRowSelected(
firstRow,
table.getState().rowSelection,
table
)

expect(result).toEqual(false)
})

it('should return some if some sub-rows are selected', () => {
const data = makeData(3, 2)
const columns = generateColumns(data)
Expand Down

0 comments on commit 82ee099

Please sign in to comment.