-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: "Filter by room type" selectable in Rooms filter (#33507)
- Loading branch information
1 parent
a15b925
commit 760ae5c
Showing
5 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustomList.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters