-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/update-contact-endpoint
- Loading branch information
Showing
7 changed files
with
84 additions
and
8 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,5 @@ | ||
--- | ||
"@rocket.chat/meteor": patch | ||
--- | ||
|
||
Restored tooltips to the unit edit department field selected options |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import type { RoomType } from '@rocket.chat/core-typings'; | ||
import { mockAppRoot } from '@rocket.chat/mock-providers'; | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import userEvent from '@testing-library/user-event'; | ||
import React from 'react'; | ||
|
||
import RoomMenu from './RoomMenu'; | ||
|
||
jest.mock('../../client/lib/rooms/roomCoordinator', () => ({ | ||
roomCoordinator: { | ||
getRoomDirectives: () => ({ | ||
getUiText: () => 'leaveWarning', | ||
}), | ||
}, | ||
})); | ||
|
||
jest.mock('../../app/ui-utils/client', () => ({ | ||
LegacyRoomManager: { | ||
close: jest.fn(), | ||
}, | ||
})); | ||
|
||
const defaultProps = { | ||
rid: 'roomId', | ||
type: 'c' as RoomType, | ||
hideDefaultOptions: false, | ||
placement: 'right-start', | ||
}; | ||
|
||
const renderOptions = { | ||
wrapper: mockAppRoot() | ||
.withTranslations('en', 'core', { | ||
Hide: 'Hide', | ||
Mark_unread: 'Mark Unread', | ||
Favorite: 'Favorite', | ||
Leave_room: 'Leave', | ||
}) | ||
.withSetting('Favorite_Rooms', true) | ||
.withPermission('leave-c') | ||
.withPermission('leave-p') | ||
.build(), | ||
legacyRoot: true, | ||
}; | ||
|
||
it('should display all the menu options for regular rooms', async () => { | ||
render(<RoomMenu {...defaultProps} />, renderOptions); | ||
|
||
const menu = screen.queryByRole('button'); | ||
await userEvent.click(menu as HTMLElement); | ||
|
||
expect(await screen.findByRole('option', { name: 'Hide' })).toBeInTheDocument(); | ||
expect(await screen.findByRole('option', { name: 'Favorite' })).toBeInTheDocument(); | ||
expect(await screen.findByRole('option', { name: 'Mark Unread' })).toBeInTheDocument(); | ||
expect(await screen.findByRole('option', { name: 'Leave' })).toBeInTheDocument(); | ||
}); | ||
|
||
it('should display only mark unread and favorite for omnichannel rooms', async () => { | ||
render(<RoomMenu {...defaultProps} type='l' />, renderOptions); | ||
|
||
const menu = screen.queryByRole('button'); | ||
await userEvent.click(menu as HTMLElement); | ||
|
||
expect(await screen.findAllByRole('option')).toHaveLength(2); | ||
expect(screen.queryByRole('option', { name: 'Hide' })).not.toBeInTheDocument(); | ||
expect(screen.queryByRole('option', { name: 'Leave' })).not.toBeInTheDocument(); | ||
}); |
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
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