Skip to content

Commit

Permalink
test(table): select all checkbox state on initial render
Browse files Browse the repository at this point in the history
  • Loading branch information
erzhan-temir-mamyrov committed Jun 16, 2023
1 parent 4397a9f commit e818f8c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/react/src/components/Table/StatefulTable.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1552,4 +1552,24 @@ describe('stateful table with real reducer', () => {
});
});
});

it('should set select all checkbox to indeterminate state', () => {
const rows = tableData.slice(0, 5);
const selectedIds = rows.map((row) => row.id);
const selectionThatWouldCauseAnIndeterminateState = selectedIds.slice(1, 5);
render(
<StatefulTable
id="tableid4"
columns={tableColumns}
data={rows}
options={{ hasRowSelection: 'multi' }}
view={{
table: {
selectedIds: selectionThatWouldCauseAnIndeterminateState,
},
}}
/>
);
expect(screen.getByLabelText('Select all items')).toHaveProperty('indeterminate', true);
});
});

0 comments on commit e818f8c

Please sign in to comment.