Skip to content

Commit

Permalink
test(tabletoolbar): add unit test for advanced filters button
Browse files Browse the repository at this point in the history
  • Loading branch information
erzhan-temir-mamyrov committed Sep 12, 2022
1 parent f1ac0a4 commit 6f9bcef
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions packages/react/src/components/Table/StatefulTable.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,55 @@ describe('stateful table with real reducer', () => {
expect(container.querySelectorAll('tbody > tr')).toHaveLength(10);
expect(screen.getByText('1–10 of 11 items')).toBeVisible();
});
it('toolbar icon is disabled when isDisabled prop set to true', () => {
render(
<StatefulTable
id="advanced-filters-disabled-icon"
{...initialState}
options={{
...initialState.options,
hasFilter: false,
hasAdvancedFilter: true,
}}
view={{
...initialState.view,
toolbar: {
...initialState.view.toolbar,
isDisabled: true,
advancedFilterFlyoutOpen: false,
},
selectedAdvancedFilterIds: ['my-filter'],
advancedFilters: [
{
filterId: 'my-filter',
filterTitleText: 'My Filter',
filterRules: {
id: '14p5ho3pcu',
groupLogic: 'ALL',
rules: [
{
id: 'rsiru4rjba',
columnId: 'date',
operand: 'CONTAINS',
value: '19',
},
{
id: '34bvyub9jq',
columnId: 'boolean',
operand: 'EQ',
value: 'true',
},
],
},
},
],
}}
/>
);
const advancedFilterToolbarIcon = screen.getByTestId('advanced-filter-flyout-button');
expect(advancedFilterToolbarIcon).toBeVisible();
expect(advancedFilterToolbarIcon).toBeDisabled();
});
});
it('properly changes state of child and parent row selections', () => {
const onRowSelectedMock = jest.fn();
Expand Down

0 comments on commit 6f9bcef

Please sign in to comment.