diff --git a/webapp/channels/src/components/channel_header_dropdown/__snapshots__/channel_header_dropdown.test.tsx.snap b/webapp/channels/src/components/channel_header_dropdown/__snapshots__/channel_header_dropdown.test.tsx.snap index 255850ed45..7ca4af943d 100644 --- a/webapp/channels/src/components/channel_header_dropdown/__snapshots__/channel_header_dropdown.test.tsx.snap +++ b/webapp/channels/src/components/channel_header_dropdown/__snapshots__/channel_header_dropdown.test.tsx.snap @@ -47,7 +47,7 @@ exports[`components/ChannelHeaderDropdown should match snapshot with no plugin i inHeaderDropdown={true} openUp={false} /> - + - - + + - - + + - - + + - - - + + + - + `; @@ -879,7 +879,7 @@ exports[`components/ChannelHeaderDropdown should match snapshot with plugins 1`] inHeaderDropdown={true} openUp={false} /> - + - - + + - - + + - - + + - - + + - - + + - + `; diff --git a/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap b/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap index 5a81689165..76ab308d4f 100644 --- a/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap +++ b/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap @@ -47,7 +47,7 @@ exports[`components/channel_header/components/UserGuideDropdown should match sna openLeft={false} openUp={false} > - + - + `; @@ -136,7 +136,7 @@ exports[`components/channel_header/components/UserGuideDropdown should match sna openLeft={false} openUp={false} > - + - + `; @@ -217,7 +217,7 @@ exports[`components/channel_header/components/UserGuideDropdown should match sna openLeft={false} openUp={false} > - + - + `; diff --git a/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/__snapshots__/product_menu_list.test.tsx.snap b/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/__snapshots__/product_menu_list.test.tsx.snap index 224874b855..dec2d91f64 100644 --- a/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/__snapshots__/product_menu_list.test.tsx.snap +++ b/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/__snapshots__/product_menu_list.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/global/product_switcher_menu should match snapshot with id 1`] = ` - +
@@ -195,11 +195,11 @@ exports[`components/global/product_switcher_menu should match snapshot with id 1 text="About " />
-
+ `; exports[`components/global/product_switcher_menu should match snapshot with most of the thing enabled 1`] = ` - +
@@ -393,7 +393,7 @@ exports[`components/global/product_switcher_menu should match snapshot with most text="About " />
-
+ `; exports[`components/global/product_switcher_menu should match userGroups snapshot with EnableCustomGroups config 1`] = ` diff --git a/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/product_menu_list.test.tsx b/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/product_menu_list.test.tsx index 3d86aef4d2..ad8a9dc93a 100644 --- a/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/product_menu_list.test.tsx +++ b/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/product_menu_list.test.tsx @@ -6,17 +6,19 @@ import React from 'react'; import type {UserProfile} from '@mattermost/types/users'; +import MenuGroup from 'components/widgets/menu/menu_group'; + import {TestHelper} from 'utils/test_helper'; import ProductMenuList from './product_menu_list'; import type {Props as ProductMenuListProps} from './product_menu_list'; describe('components/global/product_switcher_menu', () => { - // Neccessary for components enhanced by HOCs due to issue with enzyme. + // Necessary for components enhanced by HOCs due to issue with enzyme. // See https://github.com/enzymejs/enzyme/issues/539 const getMenuWrapper = (props: ProductMenuListProps) => { const wrapper = shallow(); - return wrapper.find('MenuGroup').shallow(); + return wrapper.find(MenuGroup).shallow(); }; const user = TestHelper.getUserMock({ diff --git a/webapp/channels/src/components/main_menu/__snapshots__/main_menu.test.tsx.snap b/webapp/channels/src/components/main_menu/__snapshots__/main_menu.test.tsx.snap index 766812bc44..fef7faf000 100644 --- a/webapp/channels/src/components/main_menu/__snapshots__/main_menu.test.tsx.snap +++ b/webapp/channels/src/components/main_menu/__snapshots__/main_menu.test.tsx.snap @@ -54,7 +54,7 @@ exports[`components/Menu should match snapshot with guest access disabled and no - + - - + + - - + + `; @@ -237,7 +237,7 @@ exports[`components/Menu should match snapshot with id 1`] = ` ariaLabel="team menu" id="test-id" > - + - - + + - - + + `; @@ -437,7 +437,7 @@ exports[`components/Menu should match snapshot with most of the thing disabled 1 - + - - + + - - + + `; @@ -637,7 +637,7 @@ exports[`components/Menu should match snapshot with most of the thing disabled i - + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - + + - + `; @@ -1050,7 +1050,7 @@ exports[`components/Menu should match snapshot with most of the thing enabled 1` - + - - + + - - + + `; @@ -1250,7 +1250,7 @@ exports[`components/Menu should match snapshot with most of the thing enabled in - + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - + + - + `; @@ -1665,7 +1665,7 @@ exports[`components/Menu should match snapshot with plugins 1`] = ` - + - - + + - - + + - + `; @@ -1880,7 +1880,7 @@ exports[`components/Menu should match snapshot with plugins in mobile 1`] = ` - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + `; diff --git a/webapp/channels/src/components/search/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap b/webapp/channels/src/components/search/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap index 4d51cfa22d..e528c330ce 100644 --- a/webapp/channels/src/components/search/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap +++ b/webapp/channels/src/components/search/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap @@ -45,7 +45,7 @@ exports[`UserGuideDropdown should match snapshot 1`] = ` openLeft={true} openUp={false} > - + - + `; @@ -121,7 +121,7 @@ exports[`UserGuideDropdown should match snapshot for false of enableAskCommunity openLeft={true} openUp={false} > - + - + `; diff --git a/webapp/channels/src/components/sidebar/__snapshots__/add_channels_cta_button.test.tsx.snap b/webapp/channels/src/components/sidebar/__snapshots__/add_channels_cta_button.test.tsx.snap index 52530b0f03..75cd3ebeed 100644 --- a/webapp/channels/src/components/sidebar/__snapshots__/add_channels_cta_button.test.tsx.snap +++ b/webapp/channels/src/components/sidebar/__snapshots__/add_channels_cta_button.test.tsx.snap @@ -28,7 +28,7 @@ exports[`components/new_channel_modal should match snapshot 1`] = ` ariaLabel="Add Channels Dropdown" id="AddChannelCtaDropdown" > - + - + `; diff --git a/webapp/channels/src/components/status_dropdown/__snapshots__/status_dropdown.test.tsx.snap b/webapp/channels/src/components/status_dropdown/__snapshots__/status_dropdown.test.tsx.snap index 618ab90559..35f1bf537f 100644 --- a/webapp/channels/src/components/status_dropdown/__snapshots__/status_dropdown.test.tsx.snap +++ b/webapp/channels/src/components/status_dropdown/__snapshots__/status_dropdown.test.tsx.snap @@ -58,7 +58,7 @@ exports[`components/StatusDropdown should match snapshot in default state 1`] = - + - - + + - - + + - - + + - + `; @@ -292,7 +292,7 @@ exports[`components/StatusDropdown should match snapshot with custom status and - + - - + + - - + + - - + + - - + + - + `; @@ -607,7 +607,7 @@ exports[`components/StatusDropdown should match snapshot with custom status enab - + - - + + - - + + - - + + - - + + - + `; @@ -874,7 +874,7 @@ exports[`components/StatusDropdown should match snapshot with custom status expi - + - - + + - - + + - - + + - - + + - + `; @@ -1141,7 +1141,7 @@ exports[`components/StatusDropdown should match snapshot with custom status puls - + - - + + - - + + - - + + - - + + - + `; @@ -1417,7 +1417,7 @@ exports[`components/StatusDropdown should match snapshot with profile picture UR - + - - + + - - + + - - + + - + `; @@ -1651,7 +1651,7 @@ exports[`components/StatusDropdown should match snapshot with status dropdown op - + - - + + - - + + - - + + - + `; @@ -1885,7 +1885,7 @@ exports[`components/StatusDropdown should not show clear status button when cust - + - - + + - - + + - - + + - - + + - + `; @@ -2152,7 +2152,7 @@ exports[`components/StatusDropdown should show clear status button when custom s - + - - + + - - + + - - + + - - + + - + `; diff --git a/webapp/channels/src/components/widgets/menu/menu_group.tsx b/webapp/channels/src/components/widgets/menu/menu_group.tsx index cafbf749d7..38149bee49 100644 --- a/webapp/channels/src/components/widgets/menu/menu_group.tsx +++ b/webapp/channels/src/components/widgets/menu/menu_group.tsx @@ -8,32 +8,30 @@ import './menu_group.scss'; type Props = { divider?: React.ReactNode; children?: React.ReactNode; -} +}; /** * @deprecated Use the "webapp/channels/src/components/menu" instead. */ -export default class MenuGroup extends React.PureComponent { - handleDividerClick = (e: React.MouseEvent): void => { +const MenuGroup = (props: Props) => { + const handleDividerClick = (e: React.MouseEvent): void => { e.preventDefault(); e.stopPropagation(); }; - public render() { - const {children} = this.props; + const divider = props.divider ?? ( +
  • + ); - const divider = this.props.divider || ( -
  • - ); + return ( + <> + {divider} + {props.children} + + ); +}; - return ( - - {divider} - {children} - - ); - } -} +export default React.memo(MenuGroup); diff --git a/webapp/channels/src/plugins/test/__snapshots__/main_menu_action.test.tsx.snap b/webapp/channels/src/plugins/test/__snapshots__/main_menu_action.test.tsx.snap index 07452b5091..f6dbd6236e 100644 --- a/webapp/channels/src/plugins/test/__snapshots__/main_menu_action.test.tsx.snap +++ b/webapp/channels/src/plugins/test/__snapshots__/main_menu_action.test.tsx.snap @@ -11,7 +11,7 @@ exports[`plugins/MainMenuActions should match snapshot in mobile view with some onClick={[Function]} style={Object {}} > - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + `; @@ -440,7 +440,7 @@ exports[`plugins/MainMenuActions should match snapshot in web view 1`] = ` onClick={[Function]} style={Object {}} > - + - - + + - - + + - + `;