Skip to content

Commit

Permalink
fix(Datagrid): adding test for customize column (carbon-design-system…
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratheeshrajan authored Mar 13, 2024
1 parent 1b219ff commit 8496875
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/ibm-products/src/components/Datagrid/Datagrid.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,18 @@ describe(componentName, () => {
const customizeColumnsButton = screen.getByLabelText('Customize columns');
fireEvent.click(customizeColumnsButton);
screen.getByRole('heading', { name: /Customize columns/ });
const searchInput = screen.getByPlaceholderText('Find column');
expect(searchInput.value).toBe(''); // empty before
fireEvent.change(searchInput, { target: { value: 'Visits' } });
expect(searchInput.value).toBe('Visits');
const dragItemCheckBox = screen.getByRole('checkbox', { name: 'Visits' });
fireEvent.click(dragItemCheckBox);
expect(dragItemCheckBox.checked).toEqual(false);
const columnSaveButton = screen.getByRole('button', { name: 'Save' });
fireEvent.click(columnSaveButton);
const rows = screen.getAllByRole('row');
const headerRow = rows[0];
expect(within(headerRow).queryByText('Visits') === null).toBe(true);
});

it('Top Alignment', async () => {
Expand Down

0 comments on commit 8496875

Please sign in to comment.