forked from patternfly/react-component-groups
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBulkSelect.test.tsx
More file actions
43 lines (39 loc) · 1.27 KB
/
BulkSelect.test.tsx
File metadata and controls
43 lines (39 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import BulkSelect from './BulkSelect';
describe('BulkSelect component', () => {
test('should render', () => {
expect(render(
<BulkSelect
canSelectAll
pageCount={5}
totalCount={10}
selectedCount={2}
pageSelected={false}
pagePartiallySelected={true}
onSelect={() => null}
/>)).toMatchSnapshot();
});
test('should render with dropdownListProps', async () => {
const user = userEvent.setup();
render(
<BulkSelect
canSelectAll
pageCount={5}
totalCount={10}
selectedCount={2}
pageSelected={false}
pagePartiallySelected={true}
onSelect={() => null}
dropdownListProps={{ className: 'custom-dropdown-list' }}
/>
);
// Open the dropdown by clicking the toggle button
const toggleButton = screen.getByLabelText('Bulk select toggle');
await user.click(toggleButton);
// Now the dropdown list should be visible with the custom class
const dropdownList = document.querySelector('.custom-dropdown-list');
expect(dropdownList).toBeInTheDocument();
expect(dropdownList).toHaveClass('pf-v6-c-menu__list');
});
});