fix: "Filter by room type" selectable in Rooms filter (#33507)
parent
a15b925c38
commit
760ae5c01a
@ -0,0 +1,6 @@ |
||||
--- |
||||
'@rocket.chat/ui-client': patch |
||||
'@rocket.chat/meteor': patch |
||||
--- |
||||
|
||||
Fixed an issue where "Filter by room type" was selectable in the Rooms filter. |
||||
@ -0,0 +1,44 @@ |
||||
import { render, screen } from '@testing-library/react'; |
||||
|
||||
import MultiSelectCustomList from './MultiSelectCustomList'; |
||||
|
||||
it('should render options with correct checked state', () => { |
||||
render( |
||||
<MultiSelectCustomList |
||||
options={[ |
||||
{ id: '1', text: 'Option 1', checked: true }, |
||||
{ id: '2', text: 'Option 2', checked: false }, |
||||
]} |
||||
onSelected={jest.fn()} |
||||
/>, |
||||
{ legacyRoot: true }, |
||||
); |
||||
|
||||
const option1 = screen.getByLabelText('Option 1'); |
||||
expect(option1).toBeInTheDocument(); |
||||
expect(option1).toBeChecked(); |
||||
|
||||
const option2 = screen.getByLabelText('Option 2'); |
||||
expect(option2).toBeInTheDocument(); |
||||
expect(option2).not.toBeChecked(); |
||||
}); |
||||
|
||||
it('should not render group title as selectable option', () => { |
||||
render( |
||||
<MultiSelectCustomList |
||||
options={[ |
||||
{ id: '1', text: 'Group title', isGroupTitle: true }, |
||||
{ id: '2', text: 'Option 1', checked: false }, |
||||
]} |
||||
onSelected={jest.fn()} |
||||
/>, |
||||
{ legacyRoot: true }, |
||||
); |
||||
|
||||
expect(screen.getByText('Group title')).toBeInTheDocument(); |
||||
expect(screen.queryByRole('checkbox', { name: /Group title/i })).not.toBeInTheDocument(); |
||||
|
||||
const option1 = screen.getByLabelText('Option 1'); |
||||
expect(option1).toBeInTheDocument(); |
||||
expect(option1).not.toBeChecked(); |
||||
}); |
||||
Loading…
Reference in new issue