level_0
int64
0
10k
index
int64
0
0
repo_id
stringlengths
22
152
file_path
stringlengths
41
203
content
stringlengths
11
11.5M
839
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/activity_log_modal
petrpan-code/mattermost/mattermost/webapp/channels/src/components/activity_log_modal/components/more_info.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import {General} from 'mattermost-redux/constants'; import MoreInfo from 'components/activity_log_modal/components/more_info'; import {TestHelper} from 'utils/test_helper'; describe('components/activity_log_modal/MoreInfo', () => { const baseProps = { locale: General.DEFAULT_LOCALE, currentSession: TestHelper.getSessionMock({ props: {os: 'Linux', platform: 'Linux', browser: 'Desktop App'}, id: 'sessionId', create_at: 1534917291042, last_activity_at: 1534917643890, }), moreInfo: false, handleMoreInfo: jest.fn(), }; test('should match snapshot extra info toggled off', () => { const wrapper = shallow( <MoreInfo {...baseProps}/>, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, extra info toggled on', () => { const props = {...baseProps, moreInfo: true}; const wrapper = shallow( <MoreInfo {...props}/>, ); expect(wrapper).toMatchSnapshot(); }); });
841
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/activity_log_modal/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/activity_log_modal/components/__snapshots__/activity_log.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/activity_log_modal/ActivityLog should match snapshot 1`] = ` <div className="activity-log__table" key="activityLogEntryKey0" > <div className="activity-log__report" > <div className="report__platform" > <i className="fa fa-linux" title="Linux Icon" /> <MemoizedFormattedMessage defaultMessage="Native Desktop App" id="activity_log_modal.desktop" /> </div> <div className="report__info" > <div> <MemoizedFormattedMessage defaultMessage="Last activity: {date}, {time}" id="activity_log.lastActivity" values={ Object { "date": <FormattedDate day="2-digit" month="long" value={2018-08-22T06:00:43.890Z} year="numeric" />, "time": <FormattedTime hour="2-digit" minute="2-digit" value={2018-08-22T06:00:43.890Z} />, } } /> </div> <MoreInfo currentSession={ Object { "create_at": 1534917291042, "device_id": "device_id", "expires_at": 0, "id": "sessionId", "is_oauth": false, "last_activity_at": 1534917643890, "local": false, "props": Object { "browser": "Desktop App", "os": "Linux", "platform": "Linux", }, "roles": "", "team_members": Array [], "token": "session_token", "user_id": "user_id", } } handleMoreInfo={[Function]} locale="en" moreInfo={false} /> </div> </div> <div className="activity-log__action" > <button className="btn btn-primary" onClick={[Function]} > <MemoizedFormattedMessage defaultMessage="Log Out" id="activity_log.logout" /> </button> </div> </div> `; exports[`components/activity_log_modal/ActivityLog should match snapshot with mobile props 1`] = ` <div className="activity-log__table" key="activityLogEntryKey0" > <div className="activity-log__report" > <div className="report__platform" > <i className="fa fa-apple" title="Apple Icon" /> <MemoizedFormattedMessage defaultMessage="iPhone Native Classic App" id="activity_log_modal.iphoneNativeClassicApp" /> </div> <div className="report__info" > <div> <MemoizedFormattedMessage defaultMessage="Last activity: {date}, {time}" id="activity_log.lastActivity" values={ Object { "date": <FormattedDate day="2-digit" month="long" value={2018-08-22T06:00:43.890Z} year="numeric" />, "time": <FormattedTime hour="2-digit" minute="2-digit" value={2018-08-22T06:00:43.890Z} />, } } /> </div> <MoreInfo currentSession={ Object { "create_at": 1534917291042, "device_id": "apple", "expires_at": 0, "id": "sessionId", "is_oauth": false, "last_activity_at": 1534917643890, "local": false, "props": Object { "browser": "Desktop App", "os": "Linux", "platform": "Linux", }, "roles": "", "team_members": Array [], "token": "session_token", "user_id": "user_id", } } handleMoreInfo={[Function]} locale="en" moreInfo={false} /> </div> </div> <div className="activity-log__action" > <button className="btn btn-primary" onClick={[Function]} > <MemoizedFormattedMessage defaultMessage="Log Out" id="activity_log.logout" /> </button> </div> </div> `;
842
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/activity_log_modal/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/activity_log_modal/components/__snapshots__/more_info.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/activity_log_modal/MoreInfo should match snapshot extra info toggled off 1`] = ` <a className="theme" href="#" onClick={[MockFunction]} > <MemoizedFormattedMessage defaultMessage="More info" id="activity_log.moreInfo" /> </a> `; exports[`components/activity_log_modal/MoreInfo should match snapshot, extra info toggled on 1`] = ` <div> <div> <MemoizedFormattedMessage defaultMessage="First time active: {date}, {time}" id="activity_log.firstTime" values={ Object { "date": <FormattedDate day="2-digit" month="long" value={2018-08-22T05:54:51.042Z} year="numeric" />, "time": <FormattedTime hour="2-digit" minute="2-digit" value={2018-08-22T05:54:51.042Z} />, } } /> </div> <div> <MemoizedFormattedMessage defaultMessage="OS: {os}" id="activity_log.os" values={ Object { "os": "Linux", } } /> </div> <div> <MemoizedFormattedMessage defaultMessage="Browser: {browser}" id="activity_log.browser" values={ Object { "browser": "Desktop App", } } /> </div> <div> <MemoizedFormattedMessage defaultMessage="Session ID: {id}" id="activity_log.sessionId" values={ Object { "id": "sessionId", } } /> </div> </div> `;
843
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_groups_to_channel_modal/add_groups_to_channel_modal.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import {SyncableType} from '@mattermost/types/groups'; import AddGroupsToChannelModal from 'components/add_groups_to_channel_modal/add_groups_to_channel_modal'; import type {Props} from 'components/add_groups_to_channel_modal/add_groups_to_channel_modal'; describe('components/AddGroupsToChannelModal', () => { const baseProps: Props = { currentChannelName: 'foo', currentChannelId: '123', teamID: '456', searchTerm: '', groups: [], onExited: jest.fn(), actions: { getGroupsNotAssociatedToChannel: jest.fn().mockResolvedValue({data: true}), setModalSearchTerm: jest.fn().mockResolvedValue({data: true}), linkGroupSyncable: jest.fn().mockResolvedValue({data: true, error: null}), getAllGroupsAssociatedToChannel: jest.fn().mockResolvedValue({data: true}), getTeam: jest.fn().mockResolvedValue({data: true}), getAllGroupsAssociatedToTeam: jest.fn().mockResolvedValue({data: true}), }, }; test('should match snapshot', () => { const wrapper = shallow( <AddGroupsToChannelModal {...baseProps}/>, ); expect(wrapper).toMatchSnapshot(); }); test('should match state when handleResponse is called', () => { const wrapper = shallow( <AddGroupsToChannelModal {...baseProps}/>, ); wrapper.setState({saving: true, addError: ''}); const instance = wrapper.instance() as AddGroupsToChannelModal; instance.handleResponse(); expect(wrapper.state('saving')).toEqual(false); expect(wrapper.state('addError')).toEqual(null); const message = 'error message'; wrapper.setState({saving: true, addError: ''}); instance.handleResponse({message}); expect(wrapper.state('saving')).toEqual(false); expect(wrapper.state('addError')).toEqual(message); }); test('should match state when handleSubmit is called', async () => { const linkGroupSyncable = jest.fn().mockResolvedValue({error: true, data: true}); const actions = {...baseProps.actions, linkGroupSyncable}; const props = {...baseProps, actions}; const wrapper = shallow( <AddGroupsToChannelModal {...props}/>, ); const instance = wrapper.instance() as AddGroupsToChannelModal; instance.handleResponse = jest.fn(); instance.handleHide = jest.fn(); wrapper.setState({values: []}); await instance.handleSubmit(); expect(actions.linkGroupSyncable).not.toBeCalled(); expect(instance.handleResponse).not.toBeCalled(); expect(instance.handleHide).not.toBeCalled(); wrapper.setState({saving: false, values: [{id: 'id_1'}, {id: 'id_2'}]}); await instance.handleSubmit(); expect(actions.linkGroupSyncable).toBeCalled(); expect(actions.linkGroupSyncable).toHaveBeenCalledTimes(2); expect(actions.linkGroupSyncable).toBeCalledWith('id_1', baseProps.currentChannelId, SyncableType.Channel, {auto_add: true}); expect(actions.linkGroupSyncable).toBeCalledWith('id_2', baseProps.currentChannelId, SyncableType.Channel, {auto_add: true}); expect(instance.handleResponse).toBeCalledTimes(2); expect(instance.handleHide).not.toBeCalled(); expect(wrapper.state('saving')).toEqual(true); }); test('should match state when addValue is called', () => { const wrapper = shallow( <AddGroupsToChannelModal {...baseProps}/>, ); const value1: any = {id: 'id_1', label: 'label_1', value: 'value_1'}; const value2: any = {id: 'id_2', label: 'label_2', value: 'value_2'}; wrapper.setState({values: [value1]}); const instance = wrapper.instance() as AddGroupsToChannelModal; instance.addValue(value2); expect(wrapper.state('values')).toEqual([value1, value2]); wrapper.setState({values: [value1]}); instance.addValue(value1); expect(wrapper.state('values')).toEqual([value1]); }); test('should match state when handlePageChange is called', () => { const wrapper = shallow( <AddGroupsToChannelModal {...baseProps}/>, ); wrapper.setState({users: [{id: 'id_1'}]}); const instance = wrapper.instance() as AddGroupsToChannelModal; instance.handlePageChange(0, 1); expect(baseProps.actions.getGroupsNotAssociatedToChannel).toHaveBeenCalledTimes(1); instance.handlePageChange(1, 0); expect(baseProps.actions.getGroupsNotAssociatedToChannel).toHaveBeenCalledTimes(2); instance.handlePageChange(0, 1); expect(baseProps.actions.getGroupsNotAssociatedToChannel).toHaveBeenCalledTimes(2); }); test('should match state when search is called', () => { const wrapper = shallow( <AddGroupsToChannelModal {...baseProps}/>, ); const instance = wrapper.instance() as AddGroupsToChannelModal; instance.search(''); expect(baseProps.actions.setModalSearchTerm).toHaveBeenCalledTimes(1); expect(baseProps.actions.setModalSearchTerm).toBeCalledWith(''); const searchTerm = 'term'; instance.search(searchTerm); expect(wrapper.state('loadingGroups')).toEqual(true); expect(baseProps.actions.setModalSearchTerm).toHaveBeenCalledTimes(2); expect(baseProps.actions.setModalSearchTerm).toBeCalledWith(searchTerm); }); test('should match state when handleDelete is called', () => { const wrapper = shallow( <AddGroupsToChannelModal {...baseProps}/>, ); const value1 = {id: 'id_1', label: 'label_1', value: 'value_1'}; const value2 = {id: 'id_2', label: 'label_2', value: 'value_2'}; const value3 = {id: 'id_3', label: 'label_3', value: 'value_3'}; wrapper.setState({values: [value1]}); const newValues: any = [value2, value3]; (wrapper.instance() as AddGroupsToChannelModal).handleDelete(newValues); expect(wrapper.state('values')).toEqual(newValues); }); test('should match when renderOption is called', () => { const wrapper = shallow( <AddGroupsToChannelModal {...baseProps}/>, ); const option: any = {id: 'id', last_picture_update: '12345', email: '[email protected]'}; let isSelected = false; function onAdd() {} //eslint-disable-line no-empty-function const instance = wrapper.instance() as AddGroupsToChannelModal; expect(instance.renderOption(option, isSelected, onAdd)).toMatchSnapshot(); isSelected = true; expect(instance.renderOption(option, isSelected, onAdd)).toMatchSnapshot(); const optionBot: any = {id: 'id', is_bot: true, last_picture_update: '12345'}; expect(instance.renderOption(optionBot, isSelected, onAdd)).toMatchSnapshot(); }); test('should match when renderValue is called', () => { const wrapper = shallow( <AddGroupsToChannelModal {...baseProps}/>, ); expect((wrapper.instance() as AddGroupsToChannelModal).renderValue({data: {display_name: 'foo'}})).toEqual('foo'); }); });
846
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_groups_to_channel_modal
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_groups_to_channel_modal/__snapshots__/add_groups_to_channel_modal.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/AddGroupsToChannelModal should match snapshot 1`] = ` <Modal animation={true} autoFocus={true} backdrop={true} bsClass="modal" dialogClassName="a11y__modal more-modal more-direct-channels" dialogComponentClass={[Function]} enforceFocus={true} id="addGroupsToChannelModal" keyboard={true} manager={ ModalManager { "add": [Function], "containers": Array [], "data": Array [], "handleContainerOverflow": true, "hideSiblingNodes": true, "isTopModal": [Function], "modals": Array [], "remove": [Function], } } onExited={[MockFunction]} onHide={[Function]} renderBackdrop={[Function]} restoreFocus={true} show={true} > <ModalHeader bsClass="modal-header" closeButton={true} closeLabel="Close" > <ModalTitle bsClass="modal-title" componentClass="h4" > <MemoizedFormattedMessage defaultMessage="Add New Groups to {channelName} Channel" id="add_groups_to_channel.title" values={ Object { "channelName": <strong> foo </strong>, } } /> </ModalTitle> </ModalHeader> <ModalBody bsClass="modal-body" componentClass="div" > <MultiSelect ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} handleInput={[Function]} handlePageChange={[Function]} handleSubmit={[Function]} key="addGroupsToChannelKey" loading={true} maxValues={10} numRemainingText={ <div id="numGroupsRemaining" > <Memo(MemoizedFormattedMessage) defaultMessage="Use ↑↓ to browse, ↵ to select. You can add {num, number} more {num, plural, one {group} other {groups}}. " id="multiselect.numGroupsRemaining" values={ Object { "num": 10, } } /> </div> } optionRenderer={[Function]} options={Array []} perPage={50} placeholderText="Search and add groups" saveButtonPosition="top" saving={false} savingEnabled={true} selectedItemRef={ Object { "current": null, } } valueRenderer={[Function]} valueWithImage={false} values={Array []} /> </ModalBody> </Modal> `; exports[`components/AddGroupsToChannelModal should match when renderOption is called 1`] = ` <div className="more-modal__row clickable " onClick={[Function]} onMouseMove={[Function]} > <img alt="group picture" className="more-modal__image" height="32" src={null} width="32" /> <div className="more-modal__details" > <div className="more-modal__name" >  -  <span className="more-modal__name_sub" > <Memo(MemoizedFormattedMessage) defaultMessage="{num, number} {num, plural, one {member} other {members}}" id="numMembers" values={ Object { "num": undefined, } } /> </span> </div> </div> <div className="more-modal__actions" > <div className="more-modal__actions--round" > <AddIcon /> </div> </div> </div> `; exports[`components/AddGroupsToChannelModal should match when renderOption is called 2`] = ` <div className="more-modal__row clickable more-modal__row--selected" onClick={[Function]} onMouseMove={[Function]} > <img alt="group picture" className="more-modal__image" height="32" src={null} width="32" /> <div className="more-modal__details" > <div className="more-modal__name" >  -  <span className="more-modal__name_sub" > <Memo(MemoizedFormattedMessage) defaultMessage="{num, number} {num, plural, one {member} other {members}}" id="numMembers" values={ Object { "num": undefined, } } /> </span> </div> </div> <div className="more-modal__actions" > <div className="more-modal__actions--round" > <AddIcon /> </div> </div> </div> `; exports[`components/AddGroupsToChannelModal should match when renderOption is called 3`] = ` <div className="more-modal__row clickable more-modal__row--selected" onClick={[Function]} onMouseMove={[Function]} > <img alt="group picture" className="more-modal__image" height="32" src={null} width="32" /> <div className="more-modal__details" > <div className="more-modal__name" >  -  <span className="more-modal__name_sub" > <Memo(MemoizedFormattedMessage) defaultMessage="{num, number} {num, plural, one {member} other {members}}" id="numMembers" values={ Object { "num": undefined, } } /> </span> </div> </div> <div className="more-modal__actions" > <div className="more-modal__actions--round" > <AddIcon /> </div> </div> </div> `;
847
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_groups_to_team_modal/add_groups_to_team_modal.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import {SyncableType} from '@mattermost/types/groups'; import AddGroupsToTeamModal from 'components/add_groups_to_team_modal/add_groups_to_team_modal'; describe('components/AddGroupsToTeamModal', () => { const baseProps = { currentTeamName: 'foo', currentTeamId: '123', searchTerm: '', groups: [], onExited: jest.fn(), actions: { getGroupsNotAssociatedToTeam: jest.fn().mockResolvedValue({data: true}), setModalSearchTerm: jest.fn().mockResolvedValue({data: true}), linkGroupSyncable: jest.fn().mockResolvedValue({data: true, error: null}), getAllGroupsAssociatedToTeam: jest.fn().mockResolvedValue({data: true}), }, }; test('should match snapshot', () => { const wrapper = shallow( <AddGroupsToTeamModal {...baseProps}/>, ); expect(wrapper).toMatchSnapshot(); }); test('should have called onExited when handleExit is called', () => { const wrapper = shallow<AddGroupsToTeamModal>( <AddGroupsToTeamModal {...baseProps}/>, ); wrapper.instance().handleExit(); expect(baseProps.onExited).toHaveBeenCalledTimes(1); }); test('should match state when handleResponse is called', () => { const wrapper = shallow<AddGroupsToTeamModal>( <AddGroupsToTeamModal {...baseProps}/>, ); wrapper.setState({saving: true, addError: ''}); wrapper.instance().handleResponse(); expect(wrapper.state('saving')).toEqual(false); expect(wrapper.state('addError')).toEqual(null); const message = 'error message'; wrapper.setState({saving: true, addError: ''}); wrapper.instance().handleResponse(new Error(message)); expect(wrapper.state('saving')).toEqual(false); expect(wrapper.state('addError')).toEqual(message); }); test('should match state when handleSubmit is called', async () => { const linkGroupSyncable = jest.fn().mockResolvedValue({error: true, data: true}); const actions = {...baseProps.actions, linkGroupSyncable}; const props = {...baseProps, actions}; const wrapper = shallow( <AddGroupsToTeamModal {...props}/>, ); const instance = wrapper.instance() as AddGroupsToTeamModal; instance.handleResponse = jest.fn(); instance.handleHide = jest.fn(); wrapper.setState({values: []}); await instance.handleSubmit(); expect(actions.linkGroupSyncable).not.toBeCalled(); expect(instance.handleResponse).not.toBeCalled(); expect(instance.handleHide).not.toBeCalled(); wrapper.setState({saving: false, values: [{id: 'id_1'}, {id: 'id_2'}]}); await instance.handleSubmit(); expect(actions.linkGroupSyncable).toBeCalled(); expect(actions.linkGroupSyncable).toHaveBeenCalledTimes(2); expect(actions.linkGroupSyncable).toBeCalledWith('id_1', baseProps.currentTeamId, SyncableType.Team, {auto_add: true, scheme_admin: false}); expect(actions.linkGroupSyncable).toBeCalledWith('id_2', baseProps.currentTeamId, SyncableType.Team, {auto_add: true, scheme_admin: false}); expect(instance.handleResponse).toBeCalledTimes(2); expect(instance.handleHide).not.toBeCalled(); expect(wrapper.state('saving')).toEqual(true); }); test('should match state when addValue is called', () => { const wrapper = shallow<AddGroupsToTeamModal>( <AddGroupsToTeamModal {...baseProps}/>, ); const value1 = {id: 'id_1', label: 'label_1', value: 'value_1'}; const value2 = {id: 'id_2', label: 'label_2', value: 'value_2'}; wrapper.setState({values: [value1]}); wrapper.instance().addValue(value2); expect(wrapper.state('values')).toEqual([value1, value2]); wrapper.setState({values: [value1]}); wrapper.instance().addValue(value1); expect(wrapper.state('values')).toEqual([value1]); }); test('should match state when handlePageChange is called', () => { const wrapper = shallow<AddGroupsToTeamModal>( <AddGroupsToTeamModal {...baseProps}/>, ); wrapper.instance().handlePageChange(0, 1); expect(baseProps.actions.getGroupsNotAssociatedToTeam).toHaveBeenCalledTimes(1); wrapper.instance().handlePageChange(1, 0); expect(baseProps.actions.getGroupsNotAssociatedToTeam).toHaveBeenCalledTimes(2); wrapper.instance().handlePageChange(0, 1); expect(baseProps.actions.getGroupsNotAssociatedToTeam).toHaveBeenCalledTimes(2); }); test('should match state when search is called', () => { const wrapper = shallow<AddGroupsToTeamModal>( <AddGroupsToTeamModal {...baseProps}/>, ); wrapper.instance().search(''); expect(baseProps.actions.setModalSearchTerm).toHaveBeenCalledTimes(1); expect(baseProps.actions.setModalSearchTerm).toBeCalledWith(''); const searchTerm = 'term'; wrapper.instance().search(searchTerm); expect(wrapper.state('loadingGroups')).toEqual(true); expect(baseProps.actions.setModalSearchTerm).toHaveBeenCalledTimes(2); expect(baseProps.actions.setModalSearchTerm).toBeCalledWith(searchTerm); }); test('should match state when handleDelete is called', () => { const wrapper = shallow<AddGroupsToTeamModal>( <AddGroupsToTeamModal {...baseProps}/>, ); const value1 = {id: 'id_1', label: 'label_1', value: 'value_1'}; const value2 = {id: 'id_2', label: 'label_2', value: 'value_2'}; const value3 = {id: 'id_3', label: 'label_3', value: 'value_3'}; wrapper.setState({values: [value1]}); const newValues = [value2, value3]; wrapper.instance().handleDelete(newValues); expect(wrapper.state('values')).toEqual(newValues); }); test('should match when renderOption is called', () => { const wrapper = shallow<AddGroupsToTeamModal>( <AddGroupsToTeamModal {...baseProps}/>, ); const option = {id: 'id_1', label: 'label_1', value: 'value_1'}; let isSelected = false; const onAdd = jest.fn(); const onMouseMove = jest.fn(); expect(wrapper.instance().renderOption(option, isSelected, onAdd, onMouseMove)).toMatchSnapshot(); isSelected = true; expect(wrapper.instance().renderOption(option, isSelected, onAdd, onMouseMove)).toMatchSnapshot(); }); test('should match when renderValue is called', () => { const wrapper = shallow<AddGroupsToTeamModal>( <AddGroupsToTeamModal {...baseProps}/>, ); expect(wrapper.instance().renderValue({data: {id: 'id_1', label: 'label_1', value: 'value_1', display_name: 'foo'}})).toEqual('foo'); }); });
850
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_groups_to_team_modal
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_groups_to_team_modal/__snapshots__/add_groups_to_team_modal.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/AddGroupsToTeamModal should match snapshot 1`] = ` <Modal animation={true} autoFocus={true} backdrop={true} bsClass="modal" dialogClassName="a11y__modal more-modal more-direct-channels" dialogComponentClass={[Function]} enforceFocus={true} id="addGroupsToTeamModal" keyboard={true} manager={ ModalManager { "add": [Function], "containers": Array [], "data": Array [], "handleContainerOverflow": true, "hideSiblingNodes": true, "isTopModal": [Function], "modals": Array [], "remove": [Function], } } onExited={[Function]} onHide={[Function]} renderBackdrop={[Function]} restoreFocus={true} show={true} > <ModalHeader bsClass="modal-header" closeButton={true} closeLabel="Close" > <ModalTitle bsClass="modal-title" componentClass="h1" > <MemoizedFormattedMessage defaultMessage="Add New Groups to {teamName} Team" id="add_groups_to_team.title" values={ Object { "teamName": <strong> foo </strong>, } } /> </ModalTitle> </ModalHeader> <ModalBody bsClass="modal-body" componentClass="div" > <MultiSelect ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} handleInput={[Function]} handlePageChange={[Function]} handleSubmit={[Function]} key="addGroupsToTeamKey" loading={true} maxValues={10} numRemainingText={ <div id="numGroupsRemaining" > <Memo(MemoizedFormattedMessage) defaultMessage="Use ↑↓ to browse, ↵ to select. You can add {num, number} more {num, plural, one {group} other {groups}}. " id="multiselect.numGroupsRemaining" values={ Object { "num": 10, } } /> </div> } optionRenderer={[Function]} options={Array []} perPage={50} placeholderText="Search and add groups" saveButtonPosition="top" saving={false} savingEnabled={true} selectedItemRef={ Object { "current": null, } } valueRenderer={[Function]} valueWithImage={false} values={Array []} /> </ModalBody> </Modal> `; exports[`components/AddGroupsToTeamModal should match when renderOption is called 1`] = ` <div className="more-modal__row clickable " onClick={[Function]} onMouseMove={[Function]} > <img alt="group picture" className="more-modal__image" height="32" src={null} width="32" /> <div className="more-modal__details" > <div className="more-modal__name" > <Nbsp /> - <Nbsp /> <span className="more-modal__name_sub" > <Memo(MemoizedFormattedMessage) defaultMessage="{num, number} {num, plural, one {member} other {members}}" id="numMembers" values={ Object { "num": undefined, } } /> </span> </div> </div> <div className="more-modal__actions" > <div className="more-modal__actions--round" > <AddIcon /> </div> </div> </div> `; exports[`components/AddGroupsToTeamModal should match when renderOption is called 2`] = ` <div className="more-modal__row clickable more-modal__row--selected" onClick={[Function]} onMouseMove={[Function]} > <img alt="group picture" className="more-modal__image" height="32" src={null} width="32" /> <div className="more-modal__details" > <div className="more-modal__name" > <Nbsp /> - <Nbsp /> <span className="more-modal__name_sub" > <Memo(MemoizedFormattedMessage) defaultMessage="{num, number} {num, plural, one {member} other {members}}" id="numMembers" values={ Object { "num": undefined, } } /> </span> </div> </div> <div className="more-modal__actions" > <div className="more-modal__actions--round" > <AddIcon /> </div> </div> </div> `;
851
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_user_to_channel_modal/add_user_to_channel_modal.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import AddUserToChannelModal from 'components/add_user_to_channel_modal/add_user_to_channel_modal'; import {TestHelper} from 'utils/test_helper'; describe('components/AddUserToChannelModal', () => { const baseProps = { channelMembers: {}, user: TestHelper.getUserMock({ id: 'someUserId', first_name: 'Fake', last_name: 'Person', }), onExited: jest.fn(), actions: { addChannelMember: jest.fn().mockResolvedValue({}), getChannelMember: jest.fn().mockResolvedValue({}), autocompleteChannelsForSearch: jest.fn().mockResolvedValue({}), }, }; it('should match snapshot', () => { const wrapper = shallow( <AddUserToChannelModal {...baseProps}/>, ); expect(wrapper.find('#add-user-to-channel-modal__add-button').props().disabled).toBe(true); expect(wrapper.find('#add-user-to-channel-modal__user-is-member').exists()).toBe(false); expect(wrapper.find('#add-user-to-channel-modal__invite-error').exists()).toBe(false); expect(wrapper).toMatchSnapshot(); }); it('should enable the add button when a channel is selected', () => { const wrapper = shallow( <AddUserToChannelModal {...baseProps}/>, ); wrapper.setState({selectedChannelId: 'someChannelId'}); expect(wrapper.find('#add-user-to-channel-modal__add-button').props().disabled).toBe(false); expect(wrapper.find('#add-user-to-channel-modal__invite-error').exists()).toBe(false); }); it('should show invite error when an error message is captured', () => { const wrapper = shallow( <AddUserToChannelModal {...baseProps}/>, ); wrapper.setState({submitError: 'some error'}); expect(wrapper.find('#add-user-to-channel-modal__add-button').props().disabled).toBe(true); expect(wrapper.find('#add-user-to-channel-modal__invite-error').exists()).toBe(true); }); it('should disable add button when membership is being checked', () => { const wrapper = shallow( <AddUserToChannelModal {...baseProps}/>, ); wrapper.setState({ selectedChannelId: 'someChannelId', checkingForMembership: true, }); expect(wrapper.find('#add-user-to-channel-modal__add-button').props().disabled).toBe(true); }); it('should display error message if user is a member of the selected channel', () => { const props = {...baseProps, channelMembers: { someChannelId: { someUserId: TestHelper.getChannelMembershipMock({}), }, }, }; const wrapper = shallow( <AddUserToChannelModal {...props}/>, ); wrapper.setState({selectedChannelId: 'someChannelId'}); expect(wrapper.find('#add-user-to-channel-modal__add-button').props().disabled).toBe(true); expect(wrapper.find('#add-user-to-channel-modal__user-is-member').exists()).toBe(true); }); it('should disable the add button when saving', () => { const wrapper = shallow( <AddUserToChannelModal {...baseProps}/>, ); wrapper.setState({ selectedChannelId: 'someChannelId', saving: true, }); expect(wrapper.find('#add-user-to-channel-modal__add-button').props().disabled).toBe(true); }); describe('didSelectChannel', () => { it('should fetch the selected user\'s membership for the selected channel', () => { const props = {...baseProps}; const wrapper = shallow<AddUserToChannelModal>( <AddUserToChannelModal {...props}/>, ); const selection = {channel: TestHelper.getChannelMock({id: 'someChannelId', display_name: 'channelName'})}; wrapper.instance().didSelectChannel(selection); expect(props.actions.getChannelMember).toBeCalledWith('someChannelId', 'someUserId'); }); it('should match state on selection', async () => { const promise = Promise.resolve({}); const props = { ...baseProps, actions: { ...baseProps.actions, getChannelMember: jest.fn(() => { return promise; }), }, }; const wrapper = shallow<AddUserToChannelModal>( <AddUserToChannelModal {...props}/>, ); expect(wrapper.state().text).toEqual(''); expect(wrapper.state().checkingForMembership).toEqual(false); expect(wrapper.state().selectedChannelId).toEqual(null); expect(wrapper.state().submitError).toEqual(''); const selection = {channel: TestHelper.getChannelMock({id: 'someChannelId', display_name: 'channelName'})}; wrapper.setState({submitError: 'some pre-existing error'}); wrapper.instance().didSelectChannel(selection); expect(wrapper.state().text).toEqual('channelName'); expect(wrapper.state().checkingForMembership).toEqual(true); expect(wrapper.state().selectedChannelId).toEqual('someChannelId'); expect(wrapper.state().submitError).toEqual(''); await promise; expect(wrapper.state().checkingForMembership).toEqual(false); }); }); describe('handleSubmit', () => { it('should do nothing if no channel is selected', () => { const props = {...baseProps}; const wrapper = shallow<AddUserToChannelModal>( <AddUserToChannelModal {...props}/>, ); const event: any = {stopPropagation: jest.fn(), preventDefault: jest.fn()}; wrapper.instance().handleSubmit(event); expect(wrapper.state().saving).toBe(false); expect(props.actions.addChannelMember).not.toBeCalled(); }); it('should do nothing if user is a member of the selected channel', () => { const props = {...baseProps, channelMembers: { someChannelId: { someUserId: TestHelper.getChannelMembershipMock({}), }, }, }; const wrapper = shallow<AddUserToChannelModal>( <AddUserToChannelModal {...props}/>, ); wrapper.setState({selectedChannelId: 'someChannelId'}); const event: any = {stopPropagation: jest.fn(), preventDefault: jest.fn()}; wrapper.instance().handleSubmit(event); expect(wrapper.state().saving).toBe(false); expect(props.actions.addChannelMember).not.toBeCalled(); }); it('should submit if user is not a member of the selected channel', () => { const props = {...baseProps, channelMembers: { someChannelId: {}, }, }; const wrapper = shallow<AddUserToChannelModal>( <AddUserToChannelModal {...props}/>, ); wrapper.setState({selectedChannelId: 'someChannelId'}); const event: any = {stopPropagation: jest.fn(), preventDefault: jest.fn()}; wrapper.instance().handleSubmit(event); expect(wrapper.state().saving).toBe(true); expect(props.actions.addChannelMember).toBeCalled(); }); test('should match state when save is successful', async () => { const promise = Promise.resolve({}); const props = { ...baseProps, actions: { ...baseProps.actions, addChannelMember: () => promise, }, }; const wrapper = shallow<AddUserToChannelModal>( <AddUserToChannelModal {...props}/>, ); expect(wrapper.state().show).toBe(true); expect(wrapper.state().saving).toBe(false); wrapper.setState({selectedChannelId: 'someChannelId'}); const event: any = {stopPropagation: jest.fn(), preventDefault: jest.fn()}; wrapper.instance().handleSubmit(event); expect(wrapper.state().show).toBe(true); expect(wrapper.state().saving).toBe(true); await promise; expect(wrapper.state().submitError).toEqual(''); expect(wrapper.state().show).toBe(false); }); test('should match state when save fails', async () => { const promise = Promise.resolve({error: new Error('some error')}); const props = { ...baseProps, actions: { ...baseProps.actions, addChannelMember: () => promise, }, }; const wrapper = shallow<AddUserToChannelModal>( <AddUserToChannelModal {...props}/>, ); expect(wrapper.state().show).toBe(true); wrapper.setState({selectedChannelId: 'someChannelId'}); const event: any = {stopPropagation: jest.fn(), preventDefault: jest.fn()}; wrapper.instance().handleSubmit(event); await promise; expect(wrapper.state().submitError).toEqual('some error'); expect(wrapper.state().show).toBe(true); }); }); });
854
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_user_to_channel_modal
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_user_to_channel_modal/__snapshots__/add_user_to_channel_modal.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/AddUserToChannelModal should match snapshot 1`] = ` <Modal animation={true} aria-labelledby="addChannelModalLabel" autoFocus={true} backdrop={true} bsClass="modal" dialogClassName="a11y__modal modal--overflow" dialogComponentClass={[Function]} enforceFocus={true} keyboard={true} manager={ ModalManager { "add": [Function], "containers": Array [], "data": Array [], "handleContainerOverflow": true, "hideSiblingNodes": true, "isTopModal": [Function], "modals": Array [], "remove": [Function], } } onExited={[Function]} onHide={[Function]} renderBackdrop={[Function]} restoreFocus={true} role="dialog" show={true} > <ModalHeader bsClass="modal-header" closeButton={true} closeLabel="Close" > <ModalTitle bsClass="modal-title" componentClass="h1" id="addChannelModalLabel" > <MemoizedFormattedMessage defaultMessage="Add {name} to a Channel" id="add_user_to_channel_modal.title" values={ Object { "name": "Fake Person", } } /> </ModalTitle> </ModalHeader> <form onSubmit={[Function]} role="form" > <ModalBody bsClass="modal-body" componentClass="div" > <div className="modal__hint" > <MemoizedFormattedMessage defaultMessage="Type to find a channel. Use ↑↓ to browse, ↵ to select, ESC to dismiss." id="add_user_to_channel_modal.help" /> </div> <div className="pos-relative" > <Connect(SuggestionBox) className="form-control focused" completeOnTab={false} delayInputUpdate={true} listComponent={[Function]} listPosition="bottom" maxLength="64" onChange={[Function]} onItemSelected={[Function]} openWhenEmpty={false} providers={ Array [ SearchChannelWithPermissionsProvider { "autocompleteChannelsForSearch": [MockFunction], "disableDispatches": false, "forceDispatch": false, "latestComplete": true, "latestPrefix": "", "requestStarted": false, }, ] } value="" /> </div> <div> <br /> </div> </ModalBody> <ModalFooter bsClass="modal-footer" componentClass="div" > <button className="btn btn-tertiary" onClick={[Function]} type="button" > <MemoizedFormattedMessage defaultMessage="Cancel" id="add_user_to_channel_modal.cancel" /> </button> <button className="btn btn-primary" disabled={true} id="add-user-to-channel-modal__add-button" onClick={[Function]} type="button" > <MemoizedFormattedMessage defaultMessage="Add" id="add_user_to_channel_modal.add" /> </button> </ModalFooter> </form> </Modal> `;
855
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_user_to_group_multiselect/add_user_to_group_multiselect.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import type {UserProfile} from '@mattermost/types/users'; import type {RelationOneToOne} from '@mattermost/types/utilities'; import type {Value} from 'components/multiselect/multiselect'; import AddUserToGroupMultiSelect from './add_user_to_group_multiselect'; type UserProfileValue = Value & UserProfile; describe('component/add_user_to_group_multiselect', () => { const users = [{ id: 'user-1', label: 'user-1', value: 'user-1', delete_at: 0, } as UserProfileValue, { id: 'user-2', label: 'user-2', value: 'user-2', delete_at: 0, } as UserProfileValue]; const userStatuses = { 'user-1': 'online', 'user-2': 'offline', } as RelationOneToOne<UserProfile, string>; const baseProps = { multilSelectKey: 'addUsersToGroupKey', onSubmitCallback: jest.fn().mockImplementation(() => Promise.resolve()), focusOnLoad: false, savingEnabled: false, addUserCallback: jest.fn(), deleteUserCallback: jest.fn(), profiles: [], userStatuses: {}, saving: false, actions: { getProfiles: jest.fn().mockImplementation(() => Promise.resolve()), getProfilesNotInGroup: jest.fn().mockImplementation(() => Promise.resolve()), loadStatusesForProfilesList: jest.fn().mockImplementation(() => Promise.resolve()), searchProfiles: jest.fn(), }, }; test('should match snapshot without any profiles', () => { const wrapper = shallow( <AddUserToGroupMultiSelect {...baseProps} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with profiles', () => { const wrapper = shallow( <AddUserToGroupMultiSelect {...baseProps} profiles={users} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with different submit button text', () => { const wrapper = shallow( <AddUserToGroupMultiSelect {...baseProps} profiles={users} userStatuses={userStatuses} buttonSubmitLoadingText='Updating...' buttonSubmitText='Update Group' />, ); expect(wrapper).toMatchSnapshot(); }); test('should trim the search term', () => { const wrapper = shallow<AddUserToGroupMultiSelect>( <AddUserToGroupMultiSelect {...baseProps}/>, ); wrapper.instance().search(' something '); expect(wrapper.state('term')).toEqual('something'); }); test('should add users on handleSubmit', (done) => { const wrapper = shallow<AddUserToGroupMultiSelect>( <AddUserToGroupMultiSelect {...baseProps} />, ); wrapper.setState({values: users}); wrapper.instance().handleSubmit(); expect(wrapper.instance().props.onSubmitCallback).toHaveBeenCalledTimes(1); process.nextTick(() => { done(); }); }); });
858
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_user_to_group_multiselect
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_user_to_group_multiselect/__snapshots__/add_user_to_group_multiselect.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`component/add_user_to_group_multiselect should match snapshot with different submit button text 1`] = ` <MultiSelect ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Updating..." buttonSubmitText="Update Group" focusOnLoad={false} handleAdd={[Function]} handleDelete={[Function]} handleInput={[Function]} handlePageChange={[Function]} handleSubmit={[Function]} key="addUsersToGroupKey" loading={true} numRemainingText={null} optionRenderer={[Function]} options={ Array [ Object { "delete_at": 0, "id": "user-1", "label": "user-1", "value": "user-1", }, Object { "delete_at": 0, "id": "user-2", "label": "user-2", "value": "user-2", }, ] } perPage={50} placeholderText="Search for people" saveButtonPosition="bottom" saving={false} savingEnabled={false} selectedItemRef={ Object { "current": null, } } valueWithImage={true} values={Array []} /> `; exports[`component/add_user_to_group_multiselect should match snapshot with profiles 1`] = ` <MultiSelect ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Creating..." buttonSubmitText="Create Group" focusOnLoad={false} handleAdd={[Function]} handleDelete={[Function]} handleInput={[Function]} handlePageChange={[Function]} handleSubmit={[Function]} key="addUsersToGroupKey" loading={true} numRemainingText={null} optionRenderer={[Function]} options={ Array [ Object { "delete_at": 0, "id": "user-1", "label": "user-1", "value": "user-1", }, Object { "delete_at": 0, "id": "user-2", "label": "user-2", "value": "user-2", }, ] } perPage={50} placeholderText="Search for people" saveButtonPosition="bottom" saving={false} savingEnabled={false} selectedItemRef={ Object { "current": null, } } valueWithImage={true} values={Array []} /> `; exports[`component/add_user_to_group_multiselect should match snapshot without any profiles 1`] = ` <MultiSelect ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Creating..." buttonSubmitText="Create Group" focusOnLoad={false} handleAdd={[Function]} handleDelete={[Function]} handleInput={[Function]} handlePageChange={[Function]} handleSubmit={[Function]} key="addUsersToGroupKey" loading={true} numRemainingText={null} optionRenderer={[Function]} options={Array []} perPage={50} placeholderText="Search for people" saveButtonPosition="bottom" saving={false} savingEnabled={false} selectedItemRef={ Object { "current": null, } } valueWithImage={true} values={Array []} /> `;
860
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_users_to_group_modal/add_users_to_group_modal.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import AddUsersToGroupModal from './add_users_to_group_modal'; describe('component/add_users_to_group_modal', () => { const baseProps = { onExited: jest.fn(), backButtonCallback: jest.fn(), groupId: 'groupid123', group: { id: 'groupid123', name: 'group', display_name: 'Group Name', description: 'Group description', source: 'custom', remote_id: null, create_at: 1637349374137, update_at: 1637349374137, delete_at: 0, has_syncables: false, member_count: 6, allow_reference: true, scheme_admin: false, }, actions: { openModal: jest.fn(), addUsersToGroup: jest.fn(), }, }; test('should match snapshot', () => { const wrapper = shallow( <AddUsersToGroupModal {...baseProps} />, ); expect(wrapper).toMatchSnapshot(); }); });
863
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_users_to_group_modal
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_users_to_group_modal/__snapshots__/add_users_to_group_modal.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`component/add_users_to_group_modal should match snapshot 1`] = ` <Modal animation={true} aria-labelledby="createUserGroupsModalLabel" autoFocus={true} backdrop={true} bsClass="modal" dialogClassName="a11y__modal user-groups-modal-create" dialogComponentClass={[Function]} enforceFocus={true} id="addUsersToGroupsModal" keyboard={true} manager={ ModalManager { "add": [Function], "containers": Array [], "data": Array [], "handleContainerOverflow": true, "hideSiblingNodes": true, "isTopModal": [Function], "modals": Array [], "remove": [Function], } } onExited={[MockFunction]} onHide={[Function]} renderBackdrop={[Function]} restoreFocus={true} role="dialog" show={true} > <ModalHeader bsClass="modal-header" closeButton={true} closeLabel="Close" > <button aria-label="Back" className="modal-header-back-button btn btn-icon" onClick={[Function]} type="button" > <i className="icon icon-arrow-left" /> </button> <ModalTitle bsClass="modal-title" componentClass="h1" id="addUsersToGroupsModalLabel" > <MemoizedFormattedMessage defaultMessage="Add people to {group}" id="user_groups_modal.addPeopleTitle" values={ Object { "group": "Group Name", } } /> </ModalTitle> </ModalHeader> <ModalBody bsClass="modal-body" className="overflow--visible" componentClass="div" > <div className="user-groups-modal__content" > <form role="form" > <div className="group-add-user" > <Connect(AddUserToGroupMultiSelect) addUserCallback={[Function]} backButtonClass="multiselect-back" backButtonClick={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add People" deleteUserCallback={[Function]} focusOnLoad={false} groupId="groupid123" multilSelectKey="addUsersToGroupKey" onSubmitCallback={[Function]} saving={false} savingEnabled={false} searchOptions={ Object { "not_in_group_id": "groupid123", } } /> </div> </form> </div> </ModalBody> </Modal> `;
864
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_users_to_team_modal/add_users_to_team_modal.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import type {Team} from '@mattermost/types/teams'; import type {UserProfile} from '@mattermost/types/users'; import {TestHelper} from 'utils/test_helper'; import AddUsersToTeamModal from './add_users_to_team_modal'; describe('components/admin_console/add_users_to_team_modal/AddUsersToTeamModal', () => { function createUser(id: string, username: string, bot: boolean): UserProfile { return TestHelper.getUserMock({ id, username, is_bot: bot, }); } const user1 = createUser('userid1', 'user-1', false); const user2 = createUser('userid2', 'user-2', false); const removedUser = createUser('userid-not-removed', 'user-not-removed', false); const team: Team = TestHelper.getTeamMock({ id: 'team-1', create_at: 1589222794545, update_at: 1589222794545, delete_at: 0, display_name: 'test-team', name: 'test-team', description: '', email: '', type: 'O', company_name: '', allowed_domains: '', invite_id: '', allow_open_invite: true, scheme_id: '', group_constrained: false, }); const baseProps = { team, users: [user1, user2], excludeUsers: {}, includeUsers: {}, onAddCallback: jest.fn(), onExited: jest.fn(), actions: { getProfilesNotInTeam: jest.fn(), searchProfiles: jest.fn().mockResolvedValue({data: []}), }, }; test('should match snapshot with 2 users', () => { const wrapper = shallow( <AddUsersToTeamModal {...baseProps} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with 2 users, 1 included and 1 removed', () => { const wrapper = shallow( <AddUsersToTeamModal {...baseProps} includeUsers={{[removedUser.id]: removedUser}} excludeUsers={{[user1.id]: user1}} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match state when handleHide is called', () => { const wrapper = shallow( <AddUsersToTeamModal {...baseProps}/>, ); wrapper.setState({show: true}); (wrapper.instance() as AddUsersToTeamModal).handleHide(); expect(wrapper.state('show')).toEqual(false); }); test('should search', () => { const wrapper = shallow( <AddUsersToTeamModal {...baseProps} />, ); const addUsers = wrapper.instance() as AddUsersToTeamModal; // search profiles when search term given addUsers.search('foo'); expect(baseProps.actions.searchProfiles).toHaveBeenCalledTimes(1); expect(baseProps.actions.getProfilesNotInTeam).toHaveBeenCalledTimes(1); // get profiles when no search term addUsers.search(''); expect(baseProps.actions.searchProfiles).toHaveBeenCalledTimes(1); expect(baseProps.actions.getProfilesNotInTeam).toHaveBeenCalledTimes(2); }); });
867
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_users_to_team_modal
petrpan-code/mattermost/mattermost/webapp/channels/src/components/add_users_to_team_modal/__snapshots__/add_users_to_team_modal.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/add_users_to_team_modal/AddUsersToTeamModal should match snapshot with 2 users 1`] = ` <Modal animation={true} autoFocus={true} backdrop={true} bsClass="modal" dialogClassName="a11y__modal more-modal more-direct-channels" dialogComponentClass={[Function]} enforceFocus={true} id="addUsersToTeamModal" keyboard={true} manager={ ModalManager { "add": [Function], "containers": Array [], "data": Array [], "handleContainerOverflow": true, "hideSiblingNodes": true, "isTopModal": [Function], "modals": Array [], "remove": [Function], } } onExited={[Function]} onHide={[Function]} renderBackdrop={[Function]} restoreFocus={true} show={true} > <ModalHeader bsClass="modal-header" closeButton={true} closeLabel="Close" > <ModalTitle bsClass="modal-title" componentClass="h1" > <MemoizedFormattedMessage defaultMessage="Add New Members to {teamName} Team" id="add_users_to_team.title" values={ Object { "teamName": <strong> test-team </strong>, } } /> </ModalTitle> </ModalHeader> <ModalBody bsClass="modal-body" componentClass="div" > <MultiSelect ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} handleInput={[Function]} handlePageChange={[Function]} handleSubmit={[Function]} key="addUsersToTeamKey" loading={true} maxValues={20} numRemainingText={ <div id="numPeopleRemaining" > <Memo(MemoizedFormattedMessage) defaultMessage="Use ↑↓ to browse, ↵ to select. You can add {num, number} more {num, plural, one {person} other {people}}. " id="multiselect.numPeopleRemaining" values={ Object { "num": 20, } } /> </div> } optionRenderer={[Function]} options={ Array [ Object { "auth_service": "", "bot_description": "", "create_at": 0, "delete_at": 0, "email": "", "first_name": "", "id": "userid1", "is_bot": false, "label": "user-1", "last_activity_at": 0, "last_name": "", "last_password_update": 0, "last_picture_update": 0, "locale": "", "mfa_active": false, "nickname": "", "notify_props": Object { "calls_desktop_sound": "true", "channel": "false", "comments": "never", "desktop": "default", "desktop_sound": "false", "email": "false", "first_name": "false", "highlight_keys": "", "mark_unread": "mention", "mention_keys": "", "push": "none", "push_status": "offline", }, "password": "", "position": "", "props": Object {}, "roles": "", "terms_of_service_create_at": 0, "terms_of_service_id": "", "update_at": 0, "username": "user-1", "value": "userid1", }, Object { "auth_service": "", "bot_description": "", "create_at": 0, "delete_at": 0, "email": "", "first_name": "", "id": "userid2", "is_bot": false, "label": "user-2", "last_activity_at": 0, "last_name": "", "last_password_update": 0, "last_picture_update": 0, "locale": "", "mfa_active": false, "nickname": "", "notify_props": Object { "calls_desktop_sound": "true", "channel": "false", "comments": "never", "desktop": "default", "desktop_sound": "false", "email": "false", "first_name": "false", "highlight_keys": "", "mark_unread": "mention", "mention_keys": "", "push": "none", "push_status": "offline", }, "password": "", "position": "", "props": Object {}, "roles": "", "terms_of_service_create_at": 0, "terms_of_service_id": "", "update_at": 0, "username": "user-2", "value": "userid2", }, ] } perPage={50} placeholderText="Search and add members" saveButtonPosition="top" saving={false} savingEnabled={true} selectedItemRef={ Object { "current": null, } } valueRenderer={[Function]} valueWithImage={false} values={Array []} /> </ModalBody> </Modal> `; exports[`components/admin_console/add_users_to_team_modal/AddUsersToTeamModal should match snapshot with 2 users, 1 included and 1 removed 1`] = ` <Modal animation={true} autoFocus={true} backdrop={true} bsClass="modal" dialogClassName="a11y__modal more-modal more-direct-channels" dialogComponentClass={[Function]} enforceFocus={true} id="addUsersToTeamModal" keyboard={true} manager={ ModalManager { "add": [Function], "containers": Array [], "data": Array [], "handleContainerOverflow": true, "hideSiblingNodes": true, "isTopModal": [Function], "modals": Array [], "remove": [Function], } } onExited={[Function]} onHide={[Function]} renderBackdrop={[Function]} restoreFocus={true} show={true} > <ModalHeader bsClass="modal-header" closeButton={true} closeLabel="Close" > <ModalTitle bsClass="modal-title" componentClass="h1" > <MemoizedFormattedMessage defaultMessage="Add New Members to {teamName} Team" id="add_users_to_team.title" values={ Object { "teamName": <strong> test-team </strong>, } } /> </ModalTitle> </ModalHeader> <ModalBody bsClass="modal-body" componentClass="div" > <MultiSelect ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} handleInput={[Function]} handlePageChange={[Function]} handleSubmit={[Function]} key="addUsersToTeamKey" loading={true} maxValues={20} numRemainingText={ <div id="numPeopleRemaining" > <Memo(MemoizedFormattedMessage) defaultMessage="Use ↑↓ to browse, ↵ to select. You can add {num, number} more {num, plural, one {person} other {people}}. " id="multiselect.numPeopleRemaining" values={ Object { "num": 20, } } /> </div> } optionRenderer={[Function]} options={ Array [ Object { "auth_service": "", "bot_description": "", "create_at": 0, "delete_at": 0, "email": "", "first_name": "", "id": "userid2", "is_bot": false, "label": "user-2", "last_activity_at": 0, "last_name": "", "last_password_update": 0, "last_picture_update": 0, "locale": "", "mfa_active": false, "nickname": "", "notify_props": Object { "calls_desktop_sound": "true", "channel": "false", "comments": "never", "desktop": "default", "desktop_sound": "false", "email": "false", "first_name": "false", "highlight_keys": "", "mark_unread": "mention", "mention_keys": "", "push": "none", "push_status": "offline", }, "password": "", "position": "", "props": Object {}, "roles": "", "terms_of_service_create_at": 0, "terms_of_service_id": "", "update_at": 0, "username": "user-2", "value": "userid2", }, Object { "auth_service": "", "bot_description": "", "create_at": 0, "delete_at": 0, "email": "", "first_name": "", "id": "userid-not-removed", "is_bot": false, "label": "user-not-removed", "last_activity_at": 0, "last_name": "", "last_password_update": 0, "last_picture_update": 0, "locale": "", "mfa_active": false, "nickname": "", "notify_props": Object { "calls_desktop_sound": "true", "channel": "false", "comments": "never", "desktop": "default", "desktop_sound": "false", "email": "false", "first_name": "false", "highlight_keys": "", "mark_unread": "mention", "mention_keys": "", "push": "none", "push_status": "offline", }, "password": "", "position": "", "props": Object {}, "roles": "", "terms_of_service_create_at": 0, "terms_of_service_id": "", "update_at": 0, "username": "user-not-removed", "value": "userid-not-removed", }, ] } perPage={50} placeholderText="Search and add members" saveButtonPosition="top" saving={false} savingEnabled={true} selectedItemRef={ Object { "current": null, } } valueRenderer={[Function]} valueWithImage={false} values={Array []} /> </ModalBody> </Modal> `;
873
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/bleve_settings.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import type {AdminConfig} from '@mattermost/types/config'; import BleveSettings from 'components/admin_console/bleve_settings'; jest.mock('actions/admin_actions.jsx', () => { return { blevePurgeIndexes: jest.fn(), }; }); describe('components/BleveSettings', () => { test('should match snapshot, disabled', () => { const config = { BleveSettings: { IndexDir: '', EnableIndexing: false, EnableSearching: false, EnableAutocomplete: false, }, } as AdminConfig; const wrapper = shallow( <BleveSettings config={config} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, enabled', () => { const config = { BleveSettings: { IndexDir: 'bleve.idx', EnableIndexing: true, EnableSearching: false, EnableAutocomplete: false, }, } as AdminConfig; const wrapper = shallow( <BleveSettings config={config} />, ); expect(wrapper).toMatchSnapshot(); }); });
880
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/color_setting.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import {renderWithContext, screen} from 'tests/react_testing_utils'; import ColorSetting from './color_setting'; describe('components/ColorSetting', () => { test('should match snapshot, all', () => { function emptyFunction() {} //eslint-disable-line no-empty-function const {container} = renderWithContext( <ColorSetting id='id' label='label' helpText='helptext' value='#fff' onChange={emptyFunction} disabled={false} />, ); expect(screen.getByText('helptext')).toBeInTheDocument(); expect(screen.getByTestId('color-inputColorValue')).not.toBeDisabled(); expect(container).toMatchSnapshot(); }); test('should match snapshot, no help text', () => { function emptyFunction() {} //eslint-disable-line no-empty-function const {container} = renderWithContext( <ColorSetting id='id' label='label' value='#fff' onChange={emptyFunction} disabled={false} />, ); expect(screen.queryByText('helptext')).not.toBeInTheDocument(); expect(container).toMatchSnapshot(); }); test('should match snapshot, disabled', () => { function emptyFunction() {} //eslint-disable-line no-empty-function const {container} = renderWithContext( <ColorSetting id='id' label='label' value='#fff' onChange={emptyFunction} disabled={true} />, ); expect(screen.getByTestId('color-inputColorValue')).toBeDisabled(); expect(screen.queryByText('helptext')).not.toBeInTheDocument(); expect(container).toMatchSnapshot(); }); test('should match snapshot, clicked on color setting', () => { function emptyFunction() {} //eslint-disable-line no-empty-function const {container} = renderWithContext( <ColorSetting id='id' label='label' helpText='helptext' value='#fff' onChange={emptyFunction} disabled={false} />, ); expect(screen.getByTestId('color-inputColorValue')).not.toBeDisabled(); expect(screen.queryByText('helptext')).toBeInTheDocument(); expect(container).toMatchSnapshot(); }); });
882
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/custom_enable_disable_guest_accounts_setting.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import {FormattedMessage} from 'react-intl'; import CustomEnableDisableGuestAccountsSetting from './custom_enable_disable_guest_accounts_setting'; describe('components/AdminConsole/CustomEnableDisableGuestAccountsSetting', () => { const baseProps = { id: 'MySetting', value: false, onChange: jest.fn(), cancelSubmit: jest.fn(), disabled: false, setByEnv: false, showConfirm: false, }; const warningMessage = ( <FormattedMessage defaultMessage='All current guest account sessions will be revoked, and marked as inactive' id='admin.guest_access.disableConfirmWarning' /> ); describe('initial state', () => { test('with true', () => { const props = { ...baseProps, value: true, }; const wrapper = shallow( <CustomEnableDisableGuestAccountsSetting {...props}/>, ); expect(wrapper).toMatchSnapshot(); }); test('with false', () => { const props = { ...baseProps, value: false, }; const wrapper = shallow( <CustomEnableDisableGuestAccountsSetting {...props}/>, ); expect(wrapper).toMatchSnapshot(); }); }); describe('handleChange', () => { test('should enable without show confirmation modal or warning', () => { const props = { ...baseProps, showConfirm: true, onChange: jest.fn(), }; const wrapper = shallow<CustomEnableDisableGuestAccountsSetting>( <CustomEnableDisableGuestAccountsSetting {...props}/>, ); wrapper.instance().handleChange('MySetting', true); expect(props.onChange).toBeCalledWith(baseProps.id, true, false, false, ''); }); test('should show confirmation modal and warning when disabling', () => { const props = { ...baseProps, showConfirm: true, onChange: jest.fn(), }; const wrapper = shallow<CustomEnableDisableGuestAccountsSetting>( <CustomEnableDisableGuestAccountsSetting {...props}/>, ); wrapper.instance().handleChange('MySetting', false); expect(props.onChange).toBeCalledWith(baseProps.id, false, true, false, warningMessage); }); test('should call onChange with doSubmit = true when confirm is true', () => { const props = { ...baseProps, onChange: jest.fn(), showConfirm: true, }; const wrapper = shallow<CustomEnableDisableGuestAccountsSetting>( <CustomEnableDisableGuestAccountsSetting {...props}/>, ); wrapper.instance().handleChange('MySetting', false, true); expect(props.onChange).toBeCalledWith(baseProps.id, false, true, true, warningMessage); }); }); });
884
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/custom_url_schemes_setting.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import CustomURLSchemesSetting from 'components/admin_console/custom_url_schemes_setting'; import {mountWithIntl} from 'tests/helpers/intl-test-helper'; describe('components/AdminConsole/CustomUrlSchemeSetting', () => { const baseProps = { id: 'MySetting', value: ['git', 'smtp'], onChange: jest.fn(), disabled: false, setByEnv: false, }; describe('initial state', () => { test('with no items', () => { const props = { ...baseProps, value: [], }; const wrapper = mountWithIntl( <CustomURLSchemesSetting {...props}/>, ); expect(wrapper).toMatchSnapshot(); expect(wrapper.state('value')).toEqual(''); }); test('with one item', () => { const props = { ...baseProps, value: ['git'], }; const wrapper = mountWithIntl( <CustomURLSchemesSetting {...props}/>, ); expect(wrapper).toMatchSnapshot(); expect(wrapper.state('value')).toEqual('git'); }); test('with multiple items', () => { const props = { ...baseProps, value: ['git', 'smtp', 'steam'], }; const wrapper = mountWithIntl( <CustomURLSchemesSetting {...props}/>, ); expect(wrapper).toMatchSnapshot(); expect(wrapper.state('value')).toEqual('git,smtp,steam'); }); }); describe('onChange', () => { test('called on change to empty', () => { const props = { ...baseProps, onChange: jest.fn(), }; const wrapper = mountWithIntl( <CustomURLSchemesSetting {...props}/>, ); wrapper.find('input').simulate('change', {target: {value: ''}}); expect(props.onChange).toBeCalledWith(baseProps.id, []); }); test('called on change to one item', () => { const props = { ...baseProps, onChange: jest.fn(), }; const wrapper = mountWithIntl( <CustomURLSchemesSetting {...props}/>, ); wrapper.find('input').simulate('change', {target: {value: ' steam '}}); expect(props.onChange).toBeCalledWith(baseProps.id, ['steam']); }); test('called on change to two items', () => { const props = { ...baseProps, onChange: jest.fn(), }; const wrapper = mountWithIntl( <CustomURLSchemesSetting {...props}/>, ); wrapper.find('input').simulate('change', {target: {value: 'steam, git'}}); expect(props.onChange).toBeCalledWith(baseProps.id, ['steam', 'git']); }); test('called on change to more items', () => { const props = { ...baseProps, onChange: jest.fn(), }; const wrapper = mountWithIntl( <CustomURLSchemesSetting {...props}/>, ); wrapper.find('input').simulate('change', {target: {value: 'ts3server, smtp, ms-excel'}}); expect(props.onChange).toBeCalledWith(baseProps.id, ['ts3server', 'smtp', 'ms-excel']); }); test('called on change with extra commas', () => { const props = { ...baseProps, onChange: jest.fn(), }; const wrapper = mountWithIntl( <CustomURLSchemesSetting {...props}/>, ); wrapper.find('input').simulate('change', {target: {value: ',,,,,chrome,,,,ms-excel,,'}}); expect(props.onChange).toBeCalledWith(baseProps.id, ['chrome', 'ms-excel']); }); }); test('renders properly when disabled', () => { const props = { ...baseProps, disabled: true, }; const wrapper = mountWithIntl( <CustomURLSchemesSetting {...props}/>, ); expect(wrapper).toMatchSnapshot(); }); test('renders properly when set by environment variable', () => { const props = { ...baseProps, setByEnv: true, }; const wrapper = mountWithIntl( <CustomURLSchemesSetting {...props}/>, ); expect(wrapper).toMatchSnapshot(); }); });
886
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/database_settings.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import DatabaseSettings from 'components/admin_console/database_settings'; jest.mock('actions/admin_actions.jsx', () => { const pingFn = () => { return jest.fn(() => { return {ActiveSearchBackend: 'none'}; }); }; return { recycleDatabaseConnection: jest.fn(), ping: pingFn, }; }); describe('components/DatabaseSettings', () => { const baseProps = { license: { IsLicensed: 'true', Cluster: 'true', }, }; test('should match snapshot', () => { const config = { SqlSettings: { MaxIdleConns: 10, MaxOpenConns: 100, Trace: false, DisableDatabaseSearch: true, DataSource: 'postgres://mmuser:mostest@localhost/mattermost_test?sslmode=disable\u0026connect_timeout=10', QueryTimeout: 10, ConnMaxLifetimeMilliseconds: 10, ConnMaxIdleTimeMilliseconds: 20, }, ServiceSettings: { MinimumHashtagLength: 10, }, }; const props = { ...baseProps, value: [], config, isDisabled: false, }; const wrapper = shallow( <DatabaseSettings {...props} />, ); expect(wrapper).toMatchSnapshot(); }); });
889
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/elasticsearch_settings.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import type {AdminConfig} from '@mattermost/types/config'; import ElasticSearchSettings from 'components/admin_console/elasticsearch_settings'; import SaveButton from 'components/save_button'; jest.mock('actions/admin_actions.jsx', () => { return { elasticsearchPurgeIndexes: jest.fn(), elasticsearchTest: (config: AdminConfig, success: () => void) => success(), }; }); describe('components/ElasticSearchSettings', () => { test('should match snapshot, disabled', () => { const config = { ElasticsearchSettings: { ConnectionURL: 'test', SkipTLSVerification: false, CA: 'test.ca', ClientCert: 'test.crt', ClientKey: 'test.key', Username: 'test', Password: 'test', Sniff: false, EnableIndexing: false, EnableSearching: false, EnableAutocomplete: false, }, }; const wrapper = shallow( <ElasticSearchSettings config={config as AdminConfig} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, enabled', () => { const config = { ElasticsearchSettings: { ConnectionURL: 'test', SkipTLSVerification: false, CA: 'test.ca', ClientCert: 'test.crt', ClientKey: 'test.key', Username: 'test', Password: 'test', Sniff: false, EnableIndexing: true, EnableSearching: false, EnableAutocomplete: false, }, }; const wrapper = shallow( <ElasticSearchSettings config={config as AdminConfig} />, ); expect(wrapper).toMatchSnapshot(); }); test('should maintain save disable until is tested', () => { const config = { ElasticsearchSettings: { ConnectionURL: 'test', SkipTLSVerification: false, Username: 'test', Password: 'test', Sniff: false, EnableIndexing: false, EnableSearching: false, EnableAutocomplete: false, }, }; const wrapper = shallow<ElasticSearchSettings>( <ElasticSearchSettings config={config as AdminConfig} />, ); expect(wrapper.find(SaveButton).prop('disabled')).toBe(true); wrapper.instance().handleSettingChanged('enableIndexing', true); expect(wrapper.find(SaveButton).prop('disabled')).toBe(true); const instance = wrapper.instance(); const success = jest.fn(); const error = jest.fn(); instance.doTestConfig(success, error); expect(success).toBeCalled(); expect(error).not.toBeCalled(); expect(wrapper.find(SaveButton).prop('disabled')).toBe(false); }); });
900
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/push_settings.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import type {AdminConfig} from '@mattermost/types/config'; import PushSettings from 'components/admin_console/push_settings'; describe('components/PushSettings', () => { test('should match snapshot, licensed', () => { const config = { EmailSettings: { PushNotificationServer: 'https://push.mattermost.com', PushNotificationServerType: 'mhpns', SendPushNotifications: true, }, TeamSettings: { MaxNotificationsPerChannel: 1000, }, } as AdminConfig; const props = { config, license: { IsLicensed: 'true', MHPNS: 'true', }, }; const wrapper = shallow( <PushSettings {...props}/>, ); wrapper.find('#pushNotificationServerType').simulate('change', 'pushNotificationServerType', 'mhpns'); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, unlicensed', () => { const config = { EmailSettings: { PushNotificationServer: 'https://push.mattermost.com', PushNotificationServerType: 'mhpns', SendPushNotifications: true, }, TeamSettings: { MaxNotificationsPerChannel: 1000, }, } as AdminConfig; const props = { config, license: {}, }; const wrapper = shallow( <PushSettings {...props}/>, ); expect(wrapper).toMatchSnapshot(); }); });
902
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/radio_setting.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import RadioSetting from './radio_setting'; describe('components/admin_console/RadioSetting', () => { test('should match snapshot', () => { const onChange = jest.fn(); const wrapper = shallow( <RadioSetting id='string.id' label='some label' values={[ {text: 'this is engineering', value: 'Engineering'}, {text: 'this is sales', value: 'Sales'}, {text: 'this is administration', value: 'Administration'}, ]} value={'Sales'} onChange={onChange} setByEnv={false} />, ); expect(wrapper).toMatchSnapshot(); }); test('onChange', () => { const onChange = jest.fn(); const wrapper = shallow( <RadioSetting id='string.id' label='some label' values={[ {text: 'this is engineering', value: 'Engineering'}, {text: 'this is sales', value: 'Sales'}, {text: 'this is administration', value: 'Administration'}, ]} value={'Sales'} onChange={onChange} setByEnv={false} />, ); wrapper.find('input').at(0).simulate('change', {target: {value: 'Administration'}}); expect(onChange).toHaveBeenCalledTimes(1); expect(onChange).toHaveBeenCalledWith('string.id', 'Administration'); }); });
908
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/schema_text.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import SchemaText from './schema_text'; describe('SchemaText', () => { const baseProps = { isMarkdown: false, isTranslated: false, text: 'This is help text', }; test('should render plain text correctly', () => { const wrapper = shallow(<SchemaText {...baseProps}/>); expect(wrapper).toMatchSnapshot(); }); test('should render markdown text correctly', () => { const props = { ...baseProps, isMarkdown: true, text: 'This is **HELP TEXT**', }; const wrapper = shallow(<SchemaText {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should render translated text correctly', () => { const props = { ...baseProps, isTranslated: true, text: 'help.text', textDefault: 'This is {object}', textValues: { object: 'help text', }, }; const wrapper = shallow(<SchemaText {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should render translated markdown text correctly', () => { const props = { ...baseProps, isMarkdown: true, isTranslated: true, text: 'help.text.markdown', textDefault: 'This is [{object}](https://example.com)', textValues: { object: 'a help link', }, }; const wrapper = shallow(<SchemaText {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should open external markdown links in the new window', () => { const props = { ...baseProps, isMarkdown: true, text: 'This is [a link](https://example.com)', }; const wrapper = shallow(<SchemaText {...props}/>); expect(wrapper.find('span').prop('dangerouslySetInnerHTML')).toEqual({ __html: 'This is <a href="https://example.com" rel="noopener noreferrer" target="_blank">a link</a>', }); }); test('should open internal markdown links in the same window', () => { const props = { ...baseProps, isMarkdown: true, text: 'This is [a link](http://localhost:8065/api/v4/users/src_id)', }; const wrapper = shallow(<SchemaText {...props}/>); expect(wrapper.find('span').prop('dangerouslySetInnerHTML')).toEqual({ __html: 'This is <a href="http://localhost:8065/api/v4/users/src_id">a link</a>', }); }); test('should support explicit external links like FormattedMarkdownMessage', () => { const props = { ...baseProps, isMarkdown: true, text: 'This is [a link](!https://example.com)', }; const wrapper = shallow(<SchemaText {...props}/>); expect(wrapper.find('span').prop('dangerouslySetInnerHTML')).toEqual({ __html: 'This is <a href="https://example.com" rel="noopener noreferrer" target="_blank">a link</a>', }); }); });
914
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/text_setting.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import {renderWithContext, screen} from 'tests/react_testing_utils'; import AdminTextSetting from './text_setting'; describe('components/admin_console/TextSetting', () => { test('render component with required props', () => { renderWithContext( <AdminTextSetting id='some.id' label='some label' value='some value' onChange={jest.fn()} setByEnv={false} labelClassName='' inputClassName='' maxLength={-1} resizable={true} />, ); screen.getByText('some label', {exact: false}); expect(screen.getByTestId('some.idinput')).toHaveProperty('id', 'some.id'); expect(screen.getByTestId('some.idinput')).toHaveValue('some value'); }); });
918
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/__snapshots__/bleve_settings.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/BleveSettings should match snapshot, disabled 1`] = ` <form className="form-horizontal" onSubmit={[Function]} role="form" > <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Bleve" id="admin.bleve.title" /> </AdminHeader> <SettingsGroup> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, indexing of new posts occurs automatically. Search queries will use database search until \\"Enable Bleve for search queries\\" is enabled. {documentationLink}" id="admin.bleve.enableIndexingDescription" values={ Object { "documentationLink": <ExternalLink href="https://docs.mattermost.com/deploy/bleve-search.html" location="bleve_settings" > <Memo(MemoizedFormattedMessage) defaultMessage="Learn more about Bleve in our documentation." id="admin.bleve.enableIndexingDescription.documentationLinkText" /> </ExternalLink>, } } /> } id="enableIndexing" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Bleve Indexing:" id="admin.bleve.enableIndexingTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <AdminTextSetting helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Directory path to use for store bleve indexes." id="admin.bleve.indexDirDescription" /> } id="indexDir" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Index Directory:" id="admin.bleve.indexDirTitle" /> } onChange={[Function]} setByEnv={false} value="" /> <div className="form-group" > <label className="control-label col-sm-4" > <MemoizedFormattedMessage defaultMessage="Bulk Indexing:" id="admin.bleve.bulkIndexingTitle" /> </label> <div className="col-sm-8" > <div className="job-table-setting" > <Connect(JobTable) createJobButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Index Now" id="admin.bleve.createJob.title" /> } createJobHelpText={ <Memo(MemoizedFormattedMessage) defaultMessage="All users, channels and posts in the database will be indexed from oldest to newest. Bleve is available during indexing but search results may be incomplete until the indexing job is complete." id="admin.bleve.createJob.help" /> } disabled={true} getExtraInfoText={[Function]} jobType="bleve_post_indexing" /> </div> </div> </div> <RequestButton buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Purge Index" id="admin.bleve.purgeIndexesButton" /> } disabled={true} errorMessage={ Object { "defaultMessage": "Failed to purge indexes: {error}", "id": "admin.bleve.purgeIndexesButton.error", } } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Purging will entirely remove the content of the Bleve index directory. Search results may be incomplete until a bulk index of the existing database is rebuilt." id="admin.bleve.purgeIndexesHelpText" /> } id="purgeIndexesSection" includeDetailedError={false} label={ <Memo(MemoizedFormattedMessage) defaultMessage="Purge Indexes:" id="admin.bleve.purgeIndexesButton.label" /> } requestAction={[MockFunction]} saveNeeded={false} showSuccessMessage={true} successMessage={ Object { "defaultMessage": "Indexes purged successfully.", "id": "admin.bleve.purgeIndexesButton.success", } } /> <BooleanSetting disabled={true} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, Bleve will be used for all search queries using the latest index. Search results may be incomplete until a bulk index of the existing post database is finished. When false, database search is used." id="admin.bleve.enableSearchingDescription" /> } id="enableSearching" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Bleve for search queries:" id="admin.bleve.enableSearchingTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <BooleanSetting disabled={true} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, Bleve will be used for all autocompletion queries on users and channels using the latest index. Autocompletion results may be incomplete until a bulk index of the existing users and channels database is finished. When false, database autocomplete is used." id="admin.bleve.enableAutocompleteDescription" /> } id="enableAutocomplete" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Bleve for autocomplete queries:" id="admin.bleve.enableAutocompleteTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> </SettingsGroup> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> </form> `; exports[`components/BleveSettings should match snapshot, enabled 1`] = ` <form className="form-horizontal" onSubmit={[Function]} role="form" > <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Bleve" id="admin.bleve.title" /> </AdminHeader> <SettingsGroup> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, indexing of new posts occurs automatically. Search queries will use database search until \\"Enable Bleve for search queries\\" is enabled. {documentationLink}" id="admin.bleve.enableIndexingDescription" values={ Object { "documentationLink": <ExternalLink href="https://docs.mattermost.com/deploy/bleve-search.html" location="bleve_settings" > <Memo(MemoizedFormattedMessage) defaultMessage="Learn more about Bleve in our documentation." id="admin.bleve.enableIndexingDescription.documentationLinkText" /> </ExternalLink>, } } /> } id="enableIndexing" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Bleve Indexing:" id="admin.bleve.enableIndexingTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={true} /> <AdminTextSetting helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Directory path to use for store bleve indexes." id="admin.bleve.indexDirDescription" /> } id="indexDir" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Index Directory:" id="admin.bleve.indexDirTitle" /> } onChange={[Function]} setByEnv={false} value="bleve.idx" /> <div className="form-group" > <label className="control-label col-sm-4" > <MemoizedFormattedMessage defaultMessage="Bulk Indexing:" id="admin.bleve.bulkIndexingTitle" /> </label> <div className="col-sm-8" > <div className="job-table-setting" > <Connect(JobTable) createJobButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Index Now" id="admin.bleve.createJob.title" /> } createJobHelpText={ <Memo(MemoizedFormattedMessage) defaultMessage="All users, channels and posts in the database will be indexed from oldest to newest. Bleve is available during indexing but search results may be incomplete until the indexing job is complete." id="admin.bleve.createJob.help" /> } disabled={false} getExtraInfoText={[Function]} jobType="bleve_post_indexing" /> </div> </div> </div> <RequestButton buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Purge Index" id="admin.bleve.purgeIndexesButton" /> } disabled={false} errorMessage={ Object { "defaultMessage": "Failed to purge indexes: {error}", "id": "admin.bleve.purgeIndexesButton.error", } } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Purging will entirely remove the content of the Bleve index directory. Search results may be incomplete until a bulk index of the existing database is rebuilt." id="admin.bleve.purgeIndexesHelpText" /> } id="purgeIndexesSection" includeDetailedError={false} label={ <Memo(MemoizedFormattedMessage) defaultMessage="Purge Indexes:" id="admin.bleve.purgeIndexesButton.label" /> } requestAction={[MockFunction]} saveNeeded={false} showSuccessMessage={true} successMessage={ Object { "defaultMessage": "Indexes purged successfully.", "id": "admin.bleve.purgeIndexesButton.success", } } /> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, Bleve will be used for all search queries using the latest index. Search results may be incomplete until a bulk index of the existing post database is finished. When false, database search is used." id="admin.bleve.enableSearchingDescription" /> } id="enableSearching" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Bleve for search queries:" id="admin.bleve.enableSearchingTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, Bleve will be used for all autocompletion queries on users and channels using the latest index. Autocompletion results may be incomplete until a bulk index of the existing users and channels database is finished. When false, database autocomplete is used." id="admin.bleve.enableAutocompleteDescription" /> } id="enableAutocomplete" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Bleve for autocomplete queries:" id="admin.bleve.enableAutocompleteTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> </SettingsGroup> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> </form> `;
920
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/__snapshots__/color_setting.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/ColorSetting should match snapshot, all 1`] = ` <div> <div class="form-group" data-testid="id" > <label class="control-label col-sm-4" for="id" > label </label> <div class="col-sm-8" > <div class="color-input input-group" > <input class="form-control" data-testid="color-inputColorValue" id="id-inputColorValue" maxlength="7" type="text" value="#fff" /> <span class="input-group-addon color-pad" id="id-squareColorIcon" > <i class="color-icon" id="id-squareColorIconValue" style="background-color: rgb(255, 255, 255);" /> </span> </div> <div class="help-text" data-testid="idhelp-text" > helptext </div> </div> </div> </div> `; exports[`components/ColorSetting should match snapshot, clicked on color setting 1`] = ` <div> <div class="form-group" data-testid="id" > <label class="control-label col-sm-4" for="id" > label </label> <div class="col-sm-8" > <div class="color-input input-group" > <input class="form-control" data-testid="color-inputColorValue" id="id-inputColorValue" maxlength="7" type="text" value="#fff" /> <span class="input-group-addon color-pad" id="id-squareColorIcon" > <i class="color-icon" id="id-squareColorIconValue" style="background-color: rgb(255, 255, 255);" /> </span> </div> <div class="help-text" data-testid="idhelp-text" > helptext </div> </div> </div> </div> `; exports[`components/ColorSetting should match snapshot, disabled 1`] = ` <div> <div class="form-group" data-testid="id" > <label class="control-label col-sm-4" for="id" > label </label> <div class="col-sm-8" > <div class="color-input input-group" > <input class="form-control" data-testid="color-inputColorValue" disabled="" id="id-inputColorValue" maxlength="7" type="text" value="#fff" /> </div> <div class="help-text" data-testid="idhelp-text" /> </div> </div> </div> `; exports[`components/ColorSetting should match snapshot, no help text 1`] = ` <div> <div class="form-group" data-testid="id" > <label class="control-label col-sm-4" for="id" > label </label> <div class="col-sm-8" > <div class="color-input input-group" > <input class="form-control" data-testid="color-inputColorValue" id="id-inputColorValue" maxlength="7" type="text" value="#fff" /> <span class="input-group-addon color-pad" id="id-squareColorIcon" > <i class="color-icon" id="id-squareColorIconValue" style="background-color: rgb(255, 255, 255);" /> </span> </div> <div class="help-text" data-testid="idhelp-text" /> </div> </div> </div> `;
921
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/__snapshots__/custom_enable_disable_guest_accounts_setting.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/AdminConsole/CustomEnableDisableGuestAccountsSetting initial state with false 1`] = ` <Fragment> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <FormattedMarkdownMessage defaultMessage="When true, external guest can be invited to channels within teams. Please see [Permissions Schemes](../user_management/permissions/system_scheme) for which roles can invite guests." id="admin.guest_access.enableDescription" /> } id="MySetting" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Guest Access: " id="admin.guest_access.enableTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <ConfirmModal confirmButtonClass="btn btn-primary" confirmButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Save and Disable Guest Access" id="admin.guest_access.disableConfirmButton" /> } message={ <Memo(MemoizedFormattedMessage) defaultMessage="Disabling guest access will revoke all current Guest Account sessions. Guests will no longer be able to login and new guests cannot be invited into Mattermost. Guest users will be marked as inactive in user lists. Enabling this feature will not reinstate previous guest accounts. Are you sure you wish to remove these users?" id="admin.guest_access.disableConfirmMessage" /> } modalClass="" onCancel={[MockFunction]} onConfirm={[Function]} show={false} title={ <Memo(MemoizedFormattedMessage) defaultMessage="Save and Disable Guest Access?" id="admin.guest_access.disableConfirmTitle" /> } /> </Fragment> `; exports[`components/AdminConsole/CustomEnableDisableGuestAccountsSetting initial state with true 1`] = ` <Fragment> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <FormattedMarkdownMessage defaultMessage="When true, external guest can be invited to channels within teams. Please see [Permissions Schemes](../user_management/permissions/system_scheme) for which roles can invite guests." id="admin.guest_access.enableDescription" /> } id="MySetting" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Guest Access: " id="admin.guest_access.enableTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={true} /> <ConfirmModal confirmButtonClass="btn btn-primary" confirmButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Save and Disable Guest Access" id="admin.guest_access.disableConfirmButton" /> } message={ <Memo(MemoizedFormattedMessage) defaultMessage="Disabling guest access will revoke all current Guest Account sessions. Guests will no longer be able to login and new guests cannot be invited into Mattermost. Guest users will be marked as inactive in user lists. Enabling this feature will not reinstate previous guest accounts. Are you sure you wish to remove these users?" id="admin.guest_access.disableConfirmMessage" /> } modalClass="" onCancel={[MockFunction]} onConfirm={[Function]} show={false} title={ <Memo(MemoizedFormattedMessage) defaultMessage="Save and Disable Guest Access?" id="admin.guest_access.disableConfirmTitle" /> } /> </Fragment> `;
922
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/__snapshots__/custom_url_schemes_setting.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/AdminConsole/CustomUrlSchemeSetting initial state with multiple items 1`] = ` <CustomURLSchemesSetting disabled={false} id="MySetting" intl={ Object { "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], "formatDisplayName": [Function], "formatList": [Function], "formatListToParts": [Function], "formatMessage": [Function], "formatNumber": [Function], "formatNumberToParts": [Function], "formatPlural": [Function], "formatRelativeTime": [Function], "formatTime": [Function], "formatTimeToParts": [Function], "formats": Object {}, "formatters": Object { "getDateTimeFormat": [Function], "getDisplayNames": [Function], "getListFormat": [Function], "getMessageFormat": [Function], "getNumberFormat": [Function], "getPluralRules": [Function], "getRelativeTimeFormat": [Function], }, "locale": "en", "messages": Object {}, "onError": [Function], "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", } } onChange={[MockFunction]} setByEnv={false} value={ Array [ "git", "smtp", "steam", ] } > <Memo(Settings) helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"." inputId="MySetting" label="Custom URL Schemes:" setByEnv={false} > <div className="form-group" data-testid="MySetting" > <label className="control-label col-sm-4" htmlFor="MySetting" > Custom URL Schemes: </label> <div className="col-sm-8" > <input className="form-control" disabled={false} id="MySetting" onChange={[Function]} placeholder="E.g.: \\"git,smtp\\"" type="text" value="git,smtp,steam" /> <div className="help-text" data-testid="MySettinghelp-text" > Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto". </div> </div> </div> </Memo(Settings)> </CustomURLSchemesSetting> `; exports[`components/AdminConsole/CustomUrlSchemeSetting initial state with no items 1`] = ` <CustomURLSchemesSetting disabled={false} id="MySetting" intl={ Object { "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], "formatDisplayName": [Function], "formatList": [Function], "formatListToParts": [Function], "formatMessage": [Function], "formatNumber": [Function], "formatNumberToParts": [Function], "formatPlural": [Function], "formatRelativeTime": [Function], "formatTime": [Function], "formatTimeToParts": [Function], "formats": Object {}, "formatters": Object { "getDateTimeFormat": [Function], "getDisplayNames": [Function], "getListFormat": [Function], "getMessageFormat": [Function], "getNumberFormat": [Function], "getPluralRules": [Function], "getRelativeTimeFormat": [Function], }, "locale": "en", "messages": Object {}, "onError": [Function], "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", } } onChange={[MockFunction]} setByEnv={false} value={Array []} > <Memo(Settings) helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"." inputId="MySetting" label="Custom URL Schemes:" setByEnv={false} > <div className="form-group" data-testid="MySetting" > <label className="control-label col-sm-4" htmlFor="MySetting" > Custom URL Schemes: </label> <div className="col-sm-8" > <input className="form-control" disabled={false} id="MySetting" onChange={[Function]} placeholder="E.g.: \\"git,smtp\\"" type="text" value="" /> <div className="help-text" data-testid="MySettinghelp-text" > Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto". </div> </div> </div> </Memo(Settings)> </CustomURLSchemesSetting> `; exports[`components/AdminConsole/CustomUrlSchemeSetting initial state with one item 1`] = ` <CustomURLSchemesSetting disabled={false} id="MySetting" intl={ Object { "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], "formatDisplayName": [Function], "formatList": [Function], "formatListToParts": [Function], "formatMessage": [Function], "formatNumber": [Function], "formatNumberToParts": [Function], "formatPlural": [Function], "formatRelativeTime": [Function], "formatTime": [Function], "formatTimeToParts": [Function], "formats": Object {}, "formatters": Object { "getDateTimeFormat": [Function], "getDisplayNames": [Function], "getListFormat": [Function], "getMessageFormat": [Function], "getNumberFormat": [Function], "getPluralRules": [Function], "getRelativeTimeFormat": [Function], }, "locale": "en", "messages": Object {}, "onError": [Function], "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", } } onChange={[MockFunction]} setByEnv={false} value={ Array [ "git", ] } > <Memo(Settings) helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"." inputId="MySetting" label="Custom URL Schemes:" setByEnv={false} > <div className="form-group" data-testid="MySetting" > <label className="control-label col-sm-4" htmlFor="MySetting" > Custom URL Schemes: </label> <div className="col-sm-8" > <input className="form-control" disabled={false} id="MySetting" onChange={[Function]} placeholder="E.g.: \\"git,smtp\\"" type="text" value="git" /> <div className="help-text" data-testid="MySettinghelp-text" > Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto". </div> </div> </div> </Memo(Settings)> </CustomURLSchemesSetting> `; exports[`components/AdminConsole/CustomUrlSchemeSetting renders properly when disabled 1`] = ` <CustomURLSchemesSetting disabled={true} id="MySetting" intl={ Object { "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], "formatDisplayName": [Function], "formatList": [Function], "formatListToParts": [Function], "formatMessage": [Function], "formatNumber": [Function], "formatNumberToParts": [Function], "formatPlural": [Function], "formatRelativeTime": [Function], "formatTime": [Function], "formatTimeToParts": [Function], "formats": Object {}, "formatters": Object { "getDateTimeFormat": [Function], "getDisplayNames": [Function], "getListFormat": [Function], "getMessageFormat": [Function], "getNumberFormat": [Function], "getPluralRules": [Function], "getRelativeTimeFormat": [Function], }, "locale": "en", "messages": Object {}, "onError": [Function], "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", } } onChange={[MockFunction]} setByEnv={false} value={ Array [ "git", "smtp", ] } > <Memo(Settings) helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"." inputId="MySetting" label="Custom URL Schemes:" setByEnv={false} > <div className="form-group" data-testid="MySetting" > <label className="control-label col-sm-4" htmlFor="MySetting" > Custom URL Schemes: </label> <div className="col-sm-8" > <input className="form-control" disabled={true} id="MySetting" onChange={[Function]} placeholder="E.g.: \\"git,smtp\\"" type="text" value="git,smtp" /> <div className="help-text" data-testid="MySettinghelp-text" > Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto". </div> </div> </div> </Memo(Settings)> </CustomURLSchemesSetting> `; exports[`components/AdminConsole/CustomUrlSchemeSetting renders properly when set by environment variable 1`] = ` <CustomURLSchemesSetting disabled={false} id="MySetting" intl={ Object { "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], "formatDisplayName": [Function], "formatList": [Function], "formatListToParts": [Function], "formatMessage": [Function], "formatNumber": [Function], "formatNumberToParts": [Function], "formatPlural": [Function], "formatRelativeTime": [Function], "formatTime": [Function], "formatTimeToParts": [Function], "formats": Object {}, "formatters": Object { "getDateTimeFormat": [Function], "getDisplayNames": [Function], "getListFormat": [Function], "getMessageFormat": [Function], "getNumberFormat": [Function], "getPluralRules": [Function], "getRelativeTimeFormat": [Function], }, "locale": "en", "messages": Object {}, "onError": [Function], "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", } } onChange={[MockFunction]} setByEnv={true} value={ Array [ "git", "smtp", ] } > <Memo(Settings) helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"." inputId="MySetting" label="Custom URL Schemes:" setByEnv={true} > <div className="form-group" data-testid="MySetting" > <label className="control-label col-sm-4" htmlFor="MySetting" > Custom URL Schemes: </label> <div className="col-sm-8" > <input className="form-control" disabled={true} id="MySetting" onChange={[Function]} placeholder="E.g.: \\"git,smtp\\"" type="text" value="git,smtp" /> <div className="help-text" data-testid="MySettinghelp-text" > Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto". </div> <SetByEnv> <div className="alert alert-warning" > <FormattedMessage defaultMessage="This setting has been set through an environment variable. It cannot be changed through the System Console." id="admin.set_by_env" > <span> This setting has been set through an environment variable. It cannot be changed through the System Console. </span> </FormattedMessage> </div> </SetByEnv> </div> </div> </Memo(Settings)> </CustomURLSchemesSetting> `;
923
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/__snapshots__/database_settings.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/DatabaseSettings should match snapshot 1`] = ` <form className="form-horizontal" onSubmit={[Function]} role="form" > <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Database Settings" id="admin.database.title" /> </AdminHeader> <SettingsGroup> <div className="banner" > <MemoizedFormattedMessage defaultMessage="Changing properties in this section will require a server restart before taking effect." id="admin.sql.noteDescription" /> </div> <div className="form-group" > <label className="control-label col-sm-4" htmlFor="DriverName" > <MemoizedFormattedMessage defaultMessage="Driver Name:" id="admin.sql.driverName" /> </label> <div className="col-sm-8" > <input className="form-control" disabled={true} type="text" /> <div className="help-text" > <MemoizedFormattedMessage defaultMessage="Set the database driver in the config.json file." id="admin.sql.driverNameDescription" /> </div> </div> </div> <div className="form-group" > <label className="control-label col-sm-4" htmlFor="DataSource" > <MemoizedFormattedMessage defaultMessage="Data Source:" id="admin.sql.dataSource" /> </label> <div className="col-sm-8" > <input className="form-control" disabled={true} type="text" value="**********@localhost/mattermost_test?sslmode=disable&connect_timeout=10" /> <div className="help-text" > <MemoizedFormattedMessage defaultMessage="Set the database source in the config.json file." id="admin.sql.dataSourceDescription" /> </div> </div> </div> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Maximum number of idle connections held open to the database." id="admin.sql.maxConnectionsDescription" /> } id="maxIdleConns" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Maximum Idle Connections:" id="admin.sql.maxConnectionsTitle" /> } onChange={[Function]} placeholder="E.g.: \\"10\\"" setByEnv={false} type="text" value={10} /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Maximum number of open connections held open to the database." id="admin.sql.maxOpenDescription" /> } id="maxOpenConns" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Maximum Open Connections:" id="admin.sql.maxOpenTitle" /> } onChange={[Function]} placeholder="E.g.: \\"10\\"" setByEnv={false} type="text" value={100} /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="The number of seconds to wait for a response from the database after opening a connection and sending the query. Errors that you see in the UI or in the logs as a result of a query timeout can vary depending on the type of query." id="admin.sql.queryTimeoutDescription" /> } id="queryTimeout" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Query Timeout:" id="admin.sql.queryTimeoutTitle" /> } onChange={[Function]} placeholder="E.g.: \\"30\\"" setByEnv={false} type="text" value={10} /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Maximum lifetime for a connection to the database in milliseconds." id="admin.sql.connMaxLifetimeDescription" /> } id="connMaxLifetimeMilliseconds" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Maximum Connection Lifetime:" id="admin.sql.connMaxLifetimeTitle" /> } onChange={[Function]} placeholder="E.g.: \\"3600000\\"" setByEnv={false} type="text" value={10} /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Maximum idle time for a connection to the database in milliseconds." id="admin.sql.connMaxIdleTimeDescription" /> } id="connMaxIdleTimeMilliseconds" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Maximum Connection Idle Time:" id="admin.sql.connMaxIdleTimeTitle" /> } onChange={[Function]} placeholder="E.g.: \\"300000\\"" setByEnv={false} type="text" value={20} /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Minimum number of characters in a hashtag. This must be greater than or equal to 2. MySQL databases must be configured to support searching strings shorter than three characters, <link>see documentation</link>." id="admin.service.minimumHashtagLengthDescription" values={ Object { "link": [Function], } } /> } id="minimumHashtagLength" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Minimum Hashtag Length:" id="admin.service.minimumHashtagLengthTitle" /> } onChange={[Function]} placeholder="E.g.: \\"3\\"" setByEnv={false} type="text" value={10} /> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="(Development Mode) When true, executing SQL statements are written to the log." id="admin.sql.traceDescription" /> } id="trace" label={ <Memo(MemoizedFormattedMessage) defaultMessage="SQL Statement Logging: " id="admin.sql.traceTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <RequestButton buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Recycle Database Connections" id="admin.recycle.button" /> } disabled={false} errorMessage={ Object { "defaultMessage": "Recycling unsuccessful: {error}", "id": "admin.recycle.reloadFail", } } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Deployments using multiple databases can switch from one master database to another without restarting the Mattermost server by updating \\"config.json\\" to the new desired configuration and using the {reloadConfiguration} feature to load the new settings while the server is running. The administrator should then use {featureName} feature to recycle the database connections based on the new settings." id="admin.recycle.recycleDescription" values={ Object { "featureName": <b> <Memo(MemoizedFormattedMessage) defaultMessage="Recycle Database Connections" id="admin.recycle.recycleDescription.featureName" /> </b>, "reloadConfiguration": <a href="../environment/web_server" > <b> <Memo(MemoizedFormattedMessage) defaultMessage="Environment > Web Server > Reload Configuration from Disk" id="admin.recycle.recycleDescription.reloadConfiguration" /> </b> </a>, } } /> } includeDetailedError={true} requestAction={[MockFunction]} saveNeeded={false} showSuccessMessage={false} successMessage={ Object { "defaultMessage": "Test Successful", "id": "admin.requestButton.requestSuccess", } } /> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Disables the use of the database to perform searches. Should only be used when other <link>search engines</link> are configured." id="admin.sql.disableDatabaseSearchDescription" values={ Object { "link": [Function], } } /> } id="disableDatabaseSearch" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Disable database search: " id="admin.sql.disableDatabaseSearchTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={true} /> <div className="form-group" > <label className="control-label col-sm-4" > <MemoizedFormattedMessage defaultMessage="Schema Migrations:" id="admin.database.migrations_table.title" /> </label> <div className="col-sm-8" > <div className="migrations-table-setting" > <Connect(MigrationsTable) createHelpText={ <Memo(MemoizedFormattedMessage) defaultMessage="All applied migrations." id="admin.database.migrations_table.help_text" /> } /> </div> </div> </div> <div className="form-group" > <label className="control-label col-sm-4" > <MemoizedFormattedMessage defaultMessage="Active Search Backend:" id="admin.database.search_backend.title" /> </label> <div className="col-sm-8" > <input className="form-control" disabled={true} type="text" value="" /> <div className="help-text" > <MemoizedFormattedMessage defaultMessage="Shows the currently active backend used for search. Values can be none, database, elasticsearch, bleve etc." id="admin.database.search_backend.help_text" /> </div> </div> </div> </SettingsGroup> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> </form> `;
924
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/__snapshots__/elasticsearch_settings.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/ElasticSearchSettings should match snapshot, disabled 1`] = ` <form className="form-horizontal" onSubmit={[Function]} role="form" > <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Elasticsearch" id="admin.elasticsearch.title" /> </AdminHeader> <SettingsGroup> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, indexing of new posts occurs automatically. Search queries will use database search until \\"Enable Elasticsearch for search queries\\" is enabled. {documentationLink}" id="admin.elasticsearch.enableIndexingDescription" values={ Object { "documentationLink": <ExternalLink href="https://mattermost.com/pl/setup-elasticsearch" location="elasticsearch_settings" > <Memo(MemoizedFormattedMessage) defaultMessage="Learn more about Elasticsearch in our documentation." id="admin.elasticsearch.enableIndexingDescription.documentationLinkText" /> </ExternalLink>, } } /> } id="enableIndexing" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Elasticsearch Indexing:" id="admin.elasticsearch.enableIndexingTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <AdminTextSetting disabled={true} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="The address of the Elasticsearch server. {documentationLink}" id="admin.elasticsearch.connectionUrlDescription" values={ Object { "documentationLink": <ExternalLink href="https://mattermost.com/pl/setup-elasticsearch" location="elasticsearch_settings" > <Memo(MemoizedFormattedMessage) defaultMessage="Please see documentation with server setup instructions." id="admin.elasticsearch.connectionUrlExample.documentationLinkText" /> </ExternalLink>, } } /> } id="connectionUrl" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Connection Address:" id="admin.elasticsearch.connectionUrlTitle" /> } onChange={[Function]} placeholder="E.g.: \\"https://elasticsearch.example.org:9200\\"" setByEnv={false} value="test" /> <AdminTextSetting disabled={true} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="(Optional) Custom Certificate Authority certificates for the Elasticsearch server. Leave this empty to use the default CAs from the operating system." id="admin.elasticsearch.caDescription" /> } id="ca" label={ <Memo(MemoizedFormattedMessage) defaultMessage="CA path:" id="admin.elasticsearch.caTitle" /> } onChange={[Function]} placeholder="E.g.: \\"./elasticsearch/ca.pem\\"" setByEnv={false} value="test.ca" /> <AdminTextSetting disabled={true} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="(Optional) The client certificate for the connection to the Elasticsearch server in the PEM format." id="admin.elasticsearch.clientCertDescription" /> } id="clientCert" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Client Certificate path:" id="admin.elasticsearch.clientCertTitle" /> } onChange={[Function]} placeholder="E.g.: \\"./elasticsearch/client-cert.pem\\"" setByEnv={false} value="test.crt" /> <AdminTextSetting disabled={true} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="(Optional) The key for the client certificate in the PEM format." id="admin.elasticsearch.clientKeyDescription" /> } id="clientKey" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Client Certificate Key path:" id="admin.elasticsearch.clientKeyTitle" /> } onChange={[Function]} placeholder="E.g.: \\"./elasticsearch/client-key.pem\\"" setByEnv={false} value="test.key" /> <BooleanSetting disabled={true} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, Mattermost will not require the Elasticsearch certificate to be signed by a trusted Certificate Authority." id="admin.elasticsearch.skipTLSVerificationDescription" /> } id="skipTLSVerification" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Skip TLS Verification:" id="admin.elasticsearch.skipTLSVerificationTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <AdminTextSetting disabled={true} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="(Optional) The username to authenticate to the Elasticsearch server." id="admin.elasticsearch.usernameDescription" /> } id="username" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Username:" id="admin.elasticsearch.usernameTitle" /> } onChange={[Function]} placeholder="E.g.: \\"elastic\\"" setByEnv={false} value="test" /> <AdminTextSetting disabled={true} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="(Optional) The password to authenticate to the Elasticsearch server." id="admin.elasticsearch.passwordDescription" /> } id="password" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Password:" id="admin.elasticsearch.passwordTitle" /> } onChange={[Function]} placeholder="E.g.: \\"yourpassword\\"" setByEnv={false} value="test" /> <BooleanSetting disabled={true} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, sniffing finds and connects to all data nodes in your cluster automatically." id="admin.elasticsearch.sniffDescription" /> } id="sniff" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Cluster Sniffing:" id="admin.elasticsearch.sniffTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <RequestButton buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Test Connection" id="admin.elasticsearch.elasticsearch_test_button" /> } disabled={true} errorMessage={ Object { "defaultMessage": "Test Failure: {error}", "id": "admin.requestButton.requestFailure", } } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Tests if the Mattermost server can connect to the Elasticsearch server specified. Testing the connection only saves the configuration if the test is successful. A successful test will also re-initialize the client if you have started Elasticsearch after starting Mattermost. But this will not restart the workers. To do that, please toggle \\"Enable Elasticsearch Indexing\\"." id="admin.elasticsearch.testHelpText" /> } id="testConfig" includeDetailedError={false} requestAction={[Function]} saveNeeded={false} showSuccessMessage={true} successMessage={ Object { "defaultMessage": "Test successful. Configuration saved.", "id": "admin.elasticsearch.testConfigSuccess", } } /> <div className="form-group" > <label className="control-label col-sm-4" > <MemoizedFormattedMessage defaultMessage="Bulk Indexing:" id="admin.elasticsearch.bulkIndexingTitle" /> </label> <div className="col-sm-8" > <div className="job-table-setting" > <Connect(JobTable) createJobButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Index Now" id="admin.elasticsearch.createJob.title" /> } createJobHelpText={ <Memo(MemoizedFormattedMessage) defaultMessage="All users, channels and posts in the database will be indexed from oldest to newest. Elasticsearch is available during indexing but search results may be incomplete until the indexing job is complete." id="admin.elasticsearch.createJob.help" /> } disabled={true} getExtraInfoText={[Function]} jobType="elasticsearch_post_indexing" /> </div> </div> </div> <RequestButton buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Purge Index" id="admin.elasticsearch.purgeIndexesButton" /> } disabled={true} errorMessage={ Object { "defaultMessage": "Failed to purge indexes: {error}", "id": "admin.elasticsearch.purgeIndexesButton.error", } } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Purging will entirely remove the indexes on the Elasticsearch server. Search results may be incomplete until a bulk index of the existing database is rebuilt." id="admin.elasticsearch.purgeIndexesHelpText" /> } id="purgeIndexesSection" includeDetailedError={false} label={ <Memo(MemoizedFormattedMessage) defaultMessage="Purge Indexes:" id="admin.elasticsearch.purgeIndexesButton.label" /> } requestAction={[MockFunction]} saveNeeded={false} showSuccessMessage={true} successMessage={ Object { "defaultMessage": "Indexes purged successfully.", "id": "admin.elasticsearch.purgeIndexesButton.success", } } /> <AdminTextSetting disabled={true} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When filled in, these indexes will be ignored during the purge, separated by commas." id="admin.elasticsearch.ignoredPurgeIndexesDescription" /> } id="ignoredPurgeIndexes" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Indexes to skip while purging:" id="admin.elasticsearch.ignoredPurgeIndexes" /> } onChange={[Function]} placeholder="E.g.: .opendistro*,.security*" setByEnv={false} /> <BooleanSetting disabled={true} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Requires a successful connection to the Elasticsearch server. When true, Elasticsearch will be used for all search queries using the latest index. Search results may be incomplete until a bulk index of the existing post database is finished. When false, database search is used." id="admin.elasticsearch.enableSearchingDescription" /> } id="enableSearching" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Elasticsearch for search queries:" id="admin.elasticsearch.enableSearchingTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <BooleanSetting disabled={true} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Requires a successful connection to the Elasticsearch server. When true, Elasticsearch will be used for all autocompletion queries on users and channels using the latest index. Autocompletion results may be incomplete until a bulk index of the existing users and channels database is finished. When false, database autocomplete is used." id="admin.elasticsearch.enableAutocompleteDescription" /> } id="enableAutocomplete" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Elasticsearch for autocomplete queries:" id="admin.elasticsearch.enableAutocompleteTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> </SettingsGroup> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> </form> `; exports[`components/ElasticSearchSettings should match snapshot, enabled 1`] = ` <form className="form-horizontal" onSubmit={[Function]} role="form" > <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Elasticsearch" id="admin.elasticsearch.title" /> </AdminHeader> <SettingsGroup> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, indexing of new posts occurs automatically. Search queries will use database search until \\"Enable Elasticsearch for search queries\\" is enabled. {documentationLink}" id="admin.elasticsearch.enableIndexingDescription" values={ Object { "documentationLink": <ExternalLink href="https://mattermost.com/pl/setup-elasticsearch" location="elasticsearch_settings" > <Memo(MemoizedFormattedMessage) defaultMessage="Learn more about Elasticsearch in our documentation." id="admin.elasticsearch.enableIndexingDescription.documentationLinkText" /> </ExternalLink>, } } /> } id="enableIndexing" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Elasticsearch Indexing:" id="admin.elasticsearch.enableIndexingTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={true} /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="The address of the Elasticsearch server. {documentationLink}" id="admin.elasticsearch.connectionUrlDescription" values={ Object { "documentationLink": <ExternalLink href="https://mattermost.com/pl/setup-elasticsearch" location="elasticsearch_settings" > <Memo(MemoizedFormattedMessage) defaultMessage="Please see documentation with server setup instructions." id="admin.elasticsearch.connectionUrlExample.documentationLinkText" /> </ExternalLink>, } } /> } id="connectionUrl" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Connection Address:" id="admin.elasticsearch.connectionUrlTitle" /> } onChange={[Function]} placeholder="E.g.: \\"https://elasticsearch.example.org:9200\\"" setByEnv={false} value="test" /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="(Optional) Custom Certificate Authority certificates for the Elasticsearch server. Leave this empty to use the default CAs from the operating system." id="admin.elasticsearch.caDescription" /> } id="ca" label={ <Memo(MemoizedFormattedMessage) defaultMessage="CA path:" id="admin.elasticsearch.caTitle" /> } onChange={[Function]} placeholder="E.g.: \\"./elasticsearch/ca.pem\\"" setByEnv={false} value="test.ca" /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="(Optional) The client certificate for the connection to the Elasticsearch server in the PEM format." id="admin.elasticsearch.clientCertDescription" /> } id="clientCert" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Client Certificate path:" id="admin.elasticsearch.clientCertTitle" /> } onChange={[Function]} placeholder="E.g.: \\"./elasticsearch/client-cert.pem\\"" setByEnv={false} value="test.crt" /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="(Optional) The key for the client certificate in the PEM format." id="admin.elasticsearch.clientKeyDescription" /> } id="clientKey" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Client Certificate Key path:" id="admin.elasticsearch.clientKeyTitle" /> } onChange={[Function]} placeholder="E.g.: \\"./elasticsearch/client-key.pem\\"" setByEnv={false} value="test.key" /> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, Mattermost will not require the Elasticsearch certificate to be signed by a trusted Certificate Authority." id="admin.elasticsearch.skipTLSVerificationDescription" /> } id="skipTLSVerification" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Skip TLS Verification:" id="admin.elasticsearch.skipTLSVerificationTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="(Optional) The username to authenticate to the Elasticsearch server." id="admin.elasticsearch.usernameDescription" /> } id="username" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Username:" id="admin.elasticsearch.usernameTitle" /> } onChange={[Function]} placeholder="E.g.: \\"elastic\\"" setByEnv={false} value="test" /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="(Optional) The password to authenticate to the Elasticsearch server." id="admin.elasticsearch.passwordDescription" /> } id="password" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Password:" id="admin.elasticsearch.passwordTitle" /> } onChange={[Function]} placeholder="E.g.: \\"yourpassword\\"" setByEnv={false} value="test" /> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When true, sniffing finds and connects to all data nodes in your cluster automatically." id="admin.elasticsearch.sniffDescription" /> } id="sniff" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Cluster Sniffing:" id="admin.elasticsearch.sniffTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <RequestButton buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Test Connection" id="admin.elasticsearch.elasticsearch_test_button" /> } disabled={false} errorMessage={ Object { "defaultMessage": "Test Failure: {error}", "id": "admin.requestButton.requestFailure", } } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Tests if the Mattermost server can connect to the Elasticsearch server specified. Testing the connection only saves the configuration if the test is successful. A successful test will also re-initialize the client if you have started Elasticsearch after starting Mattermost. But this will not restart the workers. To do that, please toggle \\"Enable Elasticsearch Indexing\\"." id="admin.elasticsearch.testHelpText" /> } id="testConfig" includeDetailedError={false} requestAction={[Function]} saveNeeded={false} showSuccessMessage={true} successMessage={ Object { "defaultMessage": "Test successful. Configuration saved.", "id": "admin.elasticsearch.testConfigSuccess", } } /> <div className="form-group" > <label className="control-label col-sm-4" > <MemoizedFormattedMessage defaultMessage="Bulk Indexing:" id="admin.elasticsearch.bulkIndexingTitle" /> </label> <div className="col-sm-8" > <div className="job-table-setting" > <Connect(JobTable) createJobButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Index Now" id="admin.elasticsearch.createJob.title" /> } createJobHelpText={ <Memo(MemoizedFormattedMessage) defaultMessage="All users, channels and posts in the database will be indexed from oldest to newest. Elasticsearch is available during indexing but search results may be incomplete until the indexing job is complete." id="admin.elasticsearch.createJob.help" /> } getExtraInfoText={[Function]} jobType="elasticsearch_post_indexing" /> </div> </div> </div> <RequestButton buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Purge Index" id="admin.elasticsearch.purgeIndexesButton" /> } disabled={false} errorMessage={ Object { "defaultMessage": "Failed to purge indexes: {error}", "id": "admin.elasticsearch.purgeIndexesButton.error", } } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Purging will entirely remove the indexes on the Elasticsearch server. Search results may be incomplete until a bulk index of the existing database is rebuilt." id="admin.elasticsearch.purgeIndexesHelpText" /> } id="purgeIndexesSection" includeDetailedError={false} label={ <Memo(MemoizedFormattedMessage) defaultMessage="Purge Indexes:" id="admin.elasticsearch.purgeIndexesButton.label" /> } requestAction={[MockFunction]} saveNeeded={false} showSuccessMessage={true} successMessage={ Object { "defaultMessage": "Indexes purged successfully.", "id": "admin.elasticsearch.purgeIndexesButton.success", } } /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="When filled in, these indexes will be ignored during the purge, separated by commas." id="admin.elasticsearch.ignoredPurgeIndexesDescription" /> } id="ignoredPurgeIndexes" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Indexes to skip while purging:" id="admin.elasticsearch.ignoredPurgeIndexes" /> } onChange={[Function]} placeholder="E.g.: .opendistro*,.security*" setByEnv={false} /> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Requires a successful connection to the Elasticsearch server. When true, Elasticsearch will be used for all search queries using the latest index. Search results may be incomplete until a bulk index of the existing post database is finished. When false, database search is used." id="admin.elasticsearch.enableSearchingDescription" /> } id="enableSearching" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Elasticsearch for search queries:" id="admin.elasticsearch.enableSearchingTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Requires a successful connection to the Elasticsearch server. When true, Elasticsearch will be used for all autocompletion queries on users and channels using the latest index. Autocompletion results may be incomplete until a bulk index of the existing users and channels database is finished. When false, database autocomplete is used." id="admin.elasticsearch.enableAutocompleteDescription" /> } id="enableAutocomplete" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Elasticsearch for autocomplete queries:" id="admin.elasticsearch.enableAutocompleteTitle" /> } onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> </SettingsGroup> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> </form> `;
926
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/__snapshots__/push_settings.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/PushSettings should match snapshot, licensed 1`] = ` <form className="form-horizontal" onSubmit={[Function]} role="form" > <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Push Notification Server" id="admin.environment.pushNotificationServer" /> </AdminHeader> <SettingsGroup> <Memo(DropdownSetting) helpText={null} id="pushNotificationServerType" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Push Notifications: " id="admin.email.pushTitle" /> } onChange={[Function]} setByEnv={false} value="mhpns" values={ Array [ Object { "text": "Do not send push notifications", "value": "off", }, Object { "text": "Use HPNS connection with uptime SLA to send notifications to iOS and Android apps", "value": "mhpns", }, Object { "text": "Use TPNS connection to send notifications to iOS and Android apps", "value": "mtpns", }, Object { "text": "Manually enter Push Notification Service location", "value": "custom", }, ] } /> <Memo(DropdownSetting) id="pushNotificationServerLocation" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Push Notification Server location:" id="admin.email.pushServerLocationTitle" /> } onChange={[Function]} setByEnv={false} value="us" values={ Array [ Object { "text": "US", "value": "us", }, Object { "text": "Germany", "value": "de", }, ] } /> <div className="form-group" > <div className="col-sm-4" /> <div className="col-sm-8" > <input checked={false} onChange={[Function]} type="checkbox" /> <MemoizedFormattedMessage defaultMessage=" I understand and accept the Mattermost Hosted Push Notification Service <linkTerms>Terms of Service</linkTerms> and <linkPrivacy>Privacy Policy</linkPrivacy>." id="admin.email.agreeHPNS" values={ Object { "linkPrivacy": [Function], "linkTerms": [Function], } } /> </div> </div> <AdminTextSetting disabled={true} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Download <linkIOS>Mattermost iOS app</linkIOS> from iTunes. Download <linkAndroid>Mattermost Android app</linkAndroid> from Google Play. Learn more about the <linkHPNS>Mattermost Hosted Push Notification Service</linkHPNS>." id="admin.email.mhpnsHelp" values={ Object { "linkAndroid": [Function], "linkHPNS": [Function], "linkIOS": [Function], } } /> } id="pushNotificationServer" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Push Notification Server:" id="admin.email.pushServerTitle" /> } onChange={[Function]} placeholder="E.g.: \\"https://push-test.mattermost.com\\"" setByEnv={false} value="https://push.mattermost.com" /> <AdminTextSetting helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Maximum total number of users in a channel before users typing messages, @all, @here, and @channel no longer send notifications because of performance." id="admin.team.maxNotificationsPerChannelDescription" /> } id="maxNotificationsPerChannel" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Max Notifications Per Channel:" id="admin.team.maxNotificationsPerChannelTitle" /> } onChange={[Function]} placeholder="E.g.: \\"1000\\"" setByEnv={false} type="number" value={1000} /> </SettingsGroup> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> </form> `; exports[`components/PushSettings should match snapshot, unlicensed 1`] = ` <form className="form-horizontal" onSubmit={[Function]} role="form" > <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Push Notification Server" id="admin.environment.pushNotificationServer" /> </AdminHeader> <SettingsGroup> <Memo(DropdownSetting) helpText={null} id="pushNotificationServerType" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Enable Push Notifications: " id="admin.email.pushTitle" /> } onChange={[Function]} setByEnv={false} value="custom" values={ Array [ Object { "text": "Do not send push notifications", "value": "off", }, Object { "text": "Use TPNS connection to send notifications to iOS and Android apps", "value": "mtpns", }, Object { "text": "Manually enter Push Notification Service location", "value": "custom", }, ] } /> <AdminTextSetting disabled={false} helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Learn more about compiling and deploying your own mobile apps from an <link>Enterprise App Store</link>." id="admin.email.easHelp" values={ Object { "link": [Function], } } /> } id="pushNotificationServer" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Push Notification Server:" id="admin.email.pushServerTitle" /> } onChange={[Function]} placeholder="E.g.: \\"https://push-test.mattermost.com\\"" setByEnv={false} value="https://push.mattermost.com" /> <AdminTextSetting helpText={ <Memo(MemoizedFormattedMessage) defaultMessage="Maximum total number of users in a channel before users typing messages, @all, @here, and @channel no longer send notifications because of performance." id="admin.team.maxNotificationsPerChannelDescription" /> } id="maxNotificationsPerChannel" label={ <Memo(MemoizedFormattedMessage) defaultMessage="Max Notifications Per Channel:" id="admin.team.maxNotificationsPerChannelTitle" /> } onChange={[Function]} placeholder="E.g.: \\"1000\\"" setByEnv={false} type="number" value={1000} /> </SettingsGroup> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> </form> `;
927
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/__snapshots__/radio_setting.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/RadioSetting should match snapshot 1`] = ` <Memo(Settings) inputId="string.id" label="some label" setByEnv={false} > <div className="radio" key="Engineering" > <label> <input checked={false} disabled={false} name="string.id" onChange={[Function]} type="radio" value="Engineering" /> this is engineering </label> </div> <div className="radio" key="Sales" > <label> <input checked={true} disabled={false} name="string.id" onChange={[Function]} type="radio" value="Sales" /> this is sales </label> </div> <div className="radio" key="Administration" > <label> <input checked={false} disabled={false} name="string.id" onChange={[Function]} type="radio" value="Administration" /> this is administration </label> </div> </Memo(Settings)> `;
929
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/__snapshots__/schema_text.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`SchemaText should render markdown text correctly 1`] = ` <span dangerouslySetInnerHTML={ Object { "__html": "This is <strong>HELP TEXT</strong>", } } /> `; exports[`SchemaText should render plain text correctly 1`] = ` <span> This is help text </span> `; exports[`SchemaText should render translated markdown text correctly 1`] = ` <FormattedMarkdownMessage defaultMessage="This is [{object}](https://example.com)" id="help.text.markdown" values={ Object { "object": "a help link", } } /> `; exports[`SchemaText should render translated text correctly 1`] = ` <MemoizedFormattedMessage defaultMessage="This is {object}" id="help.text" values={ Object { "object": "help text", } } /> `;
931
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/admin_button_outline/admin_button_outline.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import AdminButtonOutline from './admin_button_outline'; describe('components/admin_console/admin_button_outline/AdminButtonOutline', () => { test('should match snapshot with prop disable false', () => { const onClick = jest.fn(); const wrapper = shallow( <AdminButtonOutline onClick={onClick} className='admin-btn-default' disabled={false} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with prop disable true', () => { const onClick = jest.fn(); const wrapper = shallow( <AdminButtonOutline onClick={onClick} className='admin-btn-default' disabled={true} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with children', () => { const onClick = jest.fn(); const wrapper = shallow( <AdminButtonOutline onClick={onClick} className='admin-btn-default' disabled={true} > {'Test children'} </AdminButtonOutline>, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with className is not provided in scss file', () => { const onClick = jest.fn(); const wrapper = shallow( <AdminButtonOutline onClick={onClick} className='btn-default' disabled={true} > {'Test children'} </AdminButtonOutline>, ); expect(wrapper).toMatchSnapshot(); }); test('should handle onClick', () => { const onClick = jest.fn(); const wrapper = shallow( <AdminButtonOutline onClick={onClick} className='admin-btn-default' disabled={true} > {'Test children'} </AdminButtonOutline>, ); wrapper.find('button').simulate('click'); expect(onClick).toHaveBeenCalledTimes(1); }); });
933
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/admin_button_outline
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/admin_button_outline/__snapshots__/admin_button_outline.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/admin_button_outline/AdminButtonOutline should match snapshot with children 1`] = ` <button className="AdminButtonOutline btn admin-btn-default" disabled={true} onClick={[MockFunction]} type="button" > Test children </button> `; exports[`components/admin_console/admin_button_outline/AdminButtonOutline should match snapshot with className is not provided in scss file 1`] = ` <button className="AdminButtonOutline btn btn-default" disabled={true} onClick={[MockFunction]} type="button" > Test children </button> `; exports[`components/admin_console/admin_button_outline/AdminButtonOutline should match snapshot with prop disable false 1`] = ` <button className="AdminButtonOutline btn admin-btn-default" disabled={false} onClick={[MockFunction]} type="button" /> `; exports[`components/admin_console/admin_button_outline/AdminButtonOutline should match snapshot with prop disable true 1`] = ` <button className="AdminButtonOutline btn admin-btn-default" disabled={true} onClick={[MockFunction]} type="button" /> `;
936
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/admin_navbar_dropdown/menu_item_blockable_link.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import {renderWithContext, screen} from 'tests/react_testing_utils'; import {MenuItemBlockableLinkImpl} from './menu_item_blockable_link'; describe('components/MenuItemBlockableLink', () => { test('should render my link', () => { renderWithContext( <MenuItemBlockableLinkImpl to='/wherever' text='Whatever' />, ); screen.getByText('Whatever'); expect((screen.getByRole('link') as HTMLAnchorElement).href).toContain('/wherever'); }); });
938
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/admin_sidebar/admin_sidebar.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import type {IntlShape} from 'react-intl'; import {SelfHostedSignupProgress} from '@mattermost/types/cloud'; import type {ExperimentalSettings, PluginSettings, SSOSettings, Office365Settings} from '@mattermost/types/config'; import {RESOURCE_KEYS} from 'mattermost-redux/constants/permissions_sysconsole'; import AdminDefinition from 'components/admin_console/admin_definition'; import AdminSidebar from 'components/admin_console/admin_sidebar/admin_sidebar'; import type {Props} from 'components/admin_console/admin_sidebar/admin_sidebar'; import {samplePlugin1} from 'tests/helpers/admin_console_plugin_index_sample_pluings'; import {shallowWithIntl} from 'tests/helpers/intl-test-helper'; import {generateIndex} from 'utils/admin_console_index'; jest.mock('utils/utils', () => { const original = jest.requireActual('utils/utils'); return { ...original, isMobile: jest.fn(() => true), }; }); jest.mock('utils/admin_console_index'); describe('components/AdminSidebar', () => { const defaultProps: Props = { license: {}, config: { ExperimentalSettings: { RestrictSystemAdmin: false, } as ExperimentalSettings, PluginSettings: { Enable: true, EnableUploads: true, } as PluginSettings, FeatureFlags: {}, }, intl: {} as IntlShape, adminDefinition: AdminDefinition, buildEnterpriseReady: false, navigationBlocked: false, siteName: 'test snap', subscriptionProduct: undefined, plugins: { plugin_0: { active: false, description: 'The plugin 0.', id: 'plugin_0', name: 'Plugin 0', version: '0.1.0', settings_schema: { footer: 'This is a footer', header: 'This is a header', settings: [], }, webapp: {bundle_path: 'webapp/dist/main.js'}, }, }, onFilterChange: jest.fn(), actions: { getPlugins: jest.fn(), }, consoleAccess: { read: { about: true, reporting: true, environment: true, site_configuration: true, authentication: true, plugins: true, integrations: true, compliance: true, }, write: { about: true, reporting: true, environment: true, site_configuration: true, authentication: true, plugins: true, integrations: true, compliance: true, }, }, cloud: { limits: { limitsLoaded: false, limits: {}, }, errors: {}, selfHostedSignup: { progress: SelfHostedSignupProgress.START, }, }, showTaskList: false, }; Object.keys(RESOURCE_KEYS).forEach((key) => { Object.values(RESOURCE_KEYS[key as keyof typeof RESOURCE_KEYS]).forEach((value) => { defaultProps.consoleAccess = { ...defaultProps.consoleAccess, read: { ...defaultProps.consoleAccess.read, [value]: true, }, write: { ...defaultProps.consoleAccess.write, [value]: true, }, }; }); }); test('should match snapshot', () => { const props = {...defaultProps}; const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with workspace optimization dashboard enabled', () => { const props = { ...defaultProps, config: { ...defaultProps.config, }, }; const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, no access', () => { const props = { ...defaultProps, consoleAccess: {read: {}, write: {}}, }; const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, render plugins without any settings as well', () => { const props: Props = { license: {}, config: { ...defaultProps.config, ExperimentalSettings: { RestrictSystemAdmin: false, } as ExperimentalSettings, PluginSettings: { Enable: true, EnableUploads: true, } as PluginSettings, }, intl: {} as IntlShape, adminDefinition: AdminDefinition, buildEnterpriseReady: false, siteName: 'test snap', subscriptionProduct: undefined, navigationBlocked: false, plugins: { plugin_0: { active: false, description: 'The plugin 0.', id: 'plugin_0', name: 'Plugin 0', version: '0.1.0', settings_schema: { footer: '', header: '', settings: [], }, webapp: {bundle_path: 'webapp/dist/main.js'}, }, }, onFilterChange: jest.fn(), actions: { getPlugins: jest.fn(), }, consoleAccess: {...defaultProps.consoleAccess}, cloud: {...defaultProps.cloud}, showTaskList: false, }; const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, not prevent the console from loading when empty settings_schema provided', () => { const props: Props = { license: {}, config: { ...defaultProps.config, ExperimentalSettings: { RestrictSystemAdmin: false, } as ExperimentalSettings, PluginSettings: { Enable: true, EnableUploads: true, } as PluginSettings, }, intl: {} as IntlShape, adminDefinition: AdminDefinition, buildEnterpriseReady: false, siteName: 'test snap', subscriptionProduct: undefined, navigationBlocked: false, plugins: { plugin_0: { active: false, description: 'The plugin 0.', id: 'plugin_0', name: 'Plugin 0', version: '0.1.0', settings_schema: { footer: 'This is a footer', header: 'This is a header', settings: [], }, webapp: {bundle_path: 'webapp/dist/main.js'}, }, }, onFilterChange: jest.fn(), actions: { getPlugins: jest.fn(), }, consoleAccess: {...defaultProps.consoleAccess}, cloud: {...defaultProps.cloud}, showTaskList: false, }; const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with license (without any explicit feature)', () => { const props: Props = { license: { IsLicensed: 'true', }, config: { ...defaultProps.config, ExperimentalSettings: { RestrictSystemAdmin: false, } as ExperimentalSettings, PluginSettings: { Enable: true, EnableUploads: true, } as PluginSettings, }, intl: {} as IntlShape, adminDefinition: AdminDefinition, buildEnterpriseReady: true, navigationBlocked: false, siteName: 'test snap', subscriptionProduct: undefined, plugins: { plugin_0: { active: false, description: 'The plugin 0.', id: 'plugin_0', name: 'Plugin 0', version: '0.1.0', settings_schema: { footer: '', header: '', settings: [], }, webapp: {bundle_path: 'webapp/dist/main.js'}, }, }, onFilterChange: jest.fn(), actions: { getPlugins: jest.fn(), }, consoleAccess: {...defaultProps.consoleAccess}, cloud: {...defaultProps.cloud}, showTaskList: false, }; const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with license (with all feature)', () => { const props: Props = { license: { IsLicensed: 'true', DataRetention: 'true', LDAPGroups: 'true', LDAP: 'true', Cluster: 'true', SAML: 'true', Compliance: 'true', CustomTermsOfService: 'true', MessageExport: 'true', Elasticsearch: 'true', CustomPermissionsSchemes: 'true', OpenId: 'true', GuestAccounts: 'true', Announcement: 'true', }, config: { ...defaultProps.config, ExperimentalSettings: { RestrictSystemAdmin: false, } as ExperimentalSettings, PluginSettings: { Enable: true, EnableUploads: true, } as PluginSettings, GoogleSettings: { Id: 'googleID', Secret: 'googleSecret', Scope: 'scope', } as SSOSettings, GitLabSettings: { Id: 'gitlabID', Secret: 'gitlabSecret', Scope: 'scope', } as SSOSettings, Office365Settings: { Id: 'office365ID', Secret: 'office365Secret', Scope: 'scope', } as Office365Settings, }, intl: {} as IntlShape, adminDefinition: AdminDefinition, buildEnterpriseReady: true, navigationBlocked: false, siteName: 'test snap', subscriptionProduct: undefined, plugins: { plugin_0: { active: false, description: 'The plugin 0.', id: 'plugin_0', name: 'Plugin 0', version: '0.1.0', settings_schema: { footer: '', header: '', settings: [], }, webapp: {bundle_path: 'webapp/dist/main.js'}, }, }, onFilterChange: jest.fn(), actions: { getPlugins: jest.fn(), }, consoleAccess: {...defaultProps.consoleAccess}, cloud: {...defaultProps.cloud}, showTaskList: false, }; const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); expect(wrapper).toMatchSnapshot(); }); describe('generateIndex', () => { const props: Props = { license: {}, config: { ...defaultProps.config, ExperimentalSettings: { RestrictSystemAdmin: false, } as ExperimentalSettings, PluginSettings: { Enable: true, EnableUploads: true, } as PluginSettings, }, intl: {} as IntlShape, adminDefinition: AdminDefinition, buildEnterpriseReady: true, navigationBlocked: false, siteName: 'test snap', subscriptionProduct: undefined, plugins: { 'mattermost-autolink': samplePlugin1, }, onFilterChange: jest.fn(), actions: { getPlugins: jest.fn(), }, consoleAccess: {...defaultProps.consoleAccess}, cloud: {...defaultProps.cloud}, showTaskList: false, }; beforeEach(() => { (generateIndex as jest.Mock).mockReset(); }); test('should refresh the index in case idx is already present and there is a change in plugins or adminDefinition prop', () => { (generateIndex as jest.Mock).mockReturnValue(['mocked-index']); const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); (wrapper.instance() as any).idx = ['some value']; expect(generateIndex).toHaveBeenCalledTimes(0); wrapper.setProps({plugins: {}}); expect(generateIndex).toHaveBeenCalledTimes(1); wrapper.setProps({adminDefinition: {}}); expect(generateIndex).toHaveBeenCalledTimes(2); }); test('should not call the generate index in case of idx is not already present', () => { (generateIndex as jest.Mock).mockReturnValue(['mocked-index']); const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); expect(generateIndex).toHaveBeenCalledTimes(0); wrapper.setProps({plugins: {}}); expect(generateIndex).toHaveBeenCalledTimes(0); wrapper.setProps({adminDefinition: {}}); expect(generateIndex).toHaveBeenCalledTimes(0); }); test('should not generate index in case of same props', () => { (generateIndex as jest.Mock).mockReturnValue(['mocked-index']); const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); (wrapper.instance() as any).idx = ['some value']; expect(generateIndex).toHaveBeenCalledTimes(0); wrapper.setProps({plugins: { 'mattermost-autolink': samplePlugin1, }}); expect(generateIndex).toHaveBeenCalledTimes(0); wrapper.setProps({adminDefinition: AdminDefinition}); expect(generateIndex).toHaveBeenCalledTimes(0); }); }); describe('Plugins', () => { const idx = {search: jest.fn()}; beforeEach(() => { idx.search.mockReset(); (generateIndex as jest.Mock).mockReturnValue(idx); }); const props: Props = { license: {}, config: { ...defaultProps.config, ExperimentalSettings: { RestrictSystemAdmin: false, } as ExperimentalSettings, PluginSettings: { Enable: true, EnableUploads: true, } as PluginSettings, }, intl: {} as IntlShape, adminDefinition: AdminDefinition, buildEnterpriseReady: true, navigationBlocked: false, siteName: 'test snap', subscriptionProduct: undefined, plugins: { 'mattermost-autolink': samplePlugin1, }, onFilterChange: jest.fn(), actions: { getPlugins: jest.fn(), }, consoleAccess: { read: { plugins: true, }, write: {}, }, cloud: {...defaultProps.cloud}, showTaskList: false, }; test('should match snapshot', () => { const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should filter plugins', () => { const wrapper = shallowWithIntl(<AdminSidebar {...props}/>); idx.search.mockReturnValue(['plugin_mattermost-autolink']); wrapper.find('#adminSidebarFilter').simulate('change', {target: {value: 'autolink'}}); expect((wrapper.instance().state as any).sections).toEqual(['plugin_mattermost-autolink']); expect(wrapper).toMatchSnapshot(); expect(wrapper.find('AdminSidebarCategory')).toHaveLength(1); expect(wrapper.find('AdminSidebarSection')).toHaveLength(1); const autoLinkPluginSection = wrapper.find('AdminSidebarSection').at(0); expect(autoLinkPluginSection.prop('name')).toBe('plugins/plugin_mattermost-autolink'); }); }); });
943
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/admin_sidebar
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/admin_sidebar/__snapshots__/admin_sidebar.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/AdminSidebar Plugins should filter plugins 1`] = ` <div className="admin-sidebar" > <Connect(SidebarHeader) /> <div className="filter-container" > <SearchIcon aria-hidden="true" className="search__icon" /> <QuickInput className="filter active" clearable={true} id="adminSidebarFilter" onChange={[Function]} onClear={[Function]} placeholder="Find settings" type="text" value="autolink" /> </div> <Scrollbars autoHeight={false} autoHeightMax={200} autoHeightMin={0} autoHide={true} autoHideDuration={500} autoHideTimeout={500} hideTracksWhenNotNeeded={false} renderThumbHorizontal={[Function]} renderThumbVertical={[Function]} renderTrackHorizontal={[Function]} renderTrackVertical={[Function]} renderView={[Function]} tagName="div" thumbMinSize={30} universal={false} > <div className="nav-pills__container" > <Highlight filter="autolink" > <ul className="nav nav-pills nav-stacked" > <AdminSidebarCategory definitionKey="plugins" icon={ <PowerPlugOutlineIcon color="currentColor" size={16} /> } key="plugins" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugins" id="admin.sidebar.plugins" /> } > <AdminSidebarSection key="custompluginmattermost-autolink" name="plugins/plugin_mattermost-autolink" title="Autolink" /> </AdminSidebarCategory> </ul> </Highlight> </div> </Scrollbars> </div> `; exports[`components/AdminSidebar Plugins should match snapshot 1`] = ` <div className="admin-sidebar" > <Connect(SidebarHeader) /> <div className="filter-container" > <SearchIcon aria-hidden="true" className="search__icon" /> <QuickInput className="filter " clearable={true} id="adminSidebarFilter" onChange={[Function]} onClear={[Function]} placeholder="Find settings" type="text" value="" /> </div> <Scrollbars autoHeight={false} autoHeightMax={200} autoHeightMin={0} autoHide={true} autoHideDuration={500} autoHideTimeout={500} hideTracksWhenNotNeeded={false} renderThumbHorizontal={[Function]} renderThumbVertical={[Function]} renderTrackHorizontal={[Function]} renderTrackVertical={[Function]} renderView={[Function]} tagName="div" thumbMinSize={30} universal={false} > <div className="nav-pills__container" > <Highlight filter="" > <ul className="nav nav-pills nav-stacked" > <AdminSidebarCategory definitionKey="user_management" icon={ <AccountMultipleOutlineIcon color="currentColor" size={16} /> } key="user_management" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="User Management" id="admin.sidebar.userManagement" /> } > <AdminSidebarSection definitionKey="user_management.groups_feature_discovery" key="user_management.groups_feature_discovery" name="user_management/groups" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="enterprise" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Groups" id="admin.sidebar.groups" /> } /> <AdminSidebarSection definitionKey="user_management.system_roles_feature_discovery" key="user_management.system_roles_feature_discovery" name="user_management/system_roles" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="enterprise" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="System Roles" id="admin.sidebar.systemRoles" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="site" icon={ <CogOutlineIcon color="currentColor" size={16} /> } key="site" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Configuration" id="admin.sidebar.site" /> } > <AdminSidebarSection definitionKey="site.announcement_banner_feature_discovery" key="site.announcement_banner_feature_discovery" name="site_config/announcement_banner" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="professional" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Announcement Banner" id="admin.sidebar.announcement" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="authentication" icon={ <ShieldOutlineIcon color="currentColor" size={16} /> } key="authentication" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Authentication" id="admin.sidebar.authentication" /> } > <AdminSidebarSection definitionKey="authentication.ldap_feature_discovery" key="authentication.ldap_feature_discovery" name="authentication/ldap" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="professional" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="AD/LDAP" id="admin.sidebar.ldap" /> } /> <AdminSidebarSection definitionKey="authentication.saml_feature_discovery" key="authentication.saml_feature_discovery" name="authentication/saml" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="professional" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="SAML 2.0" id="admin.sidebar.saml" /> } /> <AdminSidebarSection definitionKey="authentication.openid_feature_discovery" key="authentication.openid_feature_discovery" name="authentication/openid" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="professional" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="OpenID Connect" id="admin.sidebar.openid" /> } /> <AdminSidebarSection definitionKey="authentication.guest_access_feature_discovery" key="authentication.guest_access_feature_discovery" name="authentication/guest_access" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="professional" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Guest Access" id="admin.sidebar.guest_access" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="plugins" icon={ <PowerPlugOutlineIcon color="currentColor" size={16} /> } key="plugins" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugins" id="admin.sidebar.plugins" /> } > <AdminSidebarSection definitionKey="plugins.plugin_management" key="plugins.plugin_management" name="plugins/plugin_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugin Management" id="admin.plugins.pluginManagement" /> } /> <AdminSidebarSection key="custompluginmattermost-autolink" name="plugins/plugin_mattermost-autolink" title="Autolink" /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="compliance" icon={ <FormatListBulletedIcon color="currentColor" size={16} /> } key="compliance" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Compliance" id="admin.sidebar.compliance" /> } > <AdminSidebarSection definitionKey="compliance.data_retention_feature_discovery" key="compliance.data_retention_feature_discovery" name="compliance/data_retention" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="enterprise" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Data Retention Policy" id="admin.sidebar.dataRetentionPolicy" /> } /> <AdminSidebarSection definitionKey="compliance.compliance_export_feature_discovery" key="compliance.compliance_export_feature_discovery" name="compliance/export" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="enterprise" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Compliance Export" id="admin.sidebar.complianceExport" /> } /> <AdminSidebarSection definitionKey="compliance.custom_terms_of_service_feature_discovery" key="compliance.custom_terms_of_service_feature_discovery" name="compliance/custom_terms_of_service" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="enterprise" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Custom Terms of Service" id="admin.sidebar.customTermsOfService" /> } /> </AdminSidebarCategory> </ul> </Highlight> </div> </Scrollbars> </div> `; exports[`components/AdminSidebar should match snapshot 1`] = ` <div className="admin-sidebar" > <Connect(SidebarHeader) /> <div className="filter-container" > <SearchIcon aria-hidden="true" className="search__icon" /> <QuickInput className="filter " clearable={true} id="adminSidebarFilter" onChange={[Function]} onClear={[Function]} placeholder="Find settings" type="text" value="" /> </div> <Scrollbars autoHeight={false} autoHeightMax={200} autoHeightMin={0} autoHide={true} autoHideDuration={500} autoHideTimeout={500} hideTracksWhenNotNeeded={false} renderThumbHorizontal={[Function]} renderThumbVertical={[Function]} renderTrackHorizontal={[Function]} renderTrackVertical={[Function]} renderView={[Function]} tagName="div" thumbMinSize={30} universal={false} > <div className="nav-pills__container" > <Highlight filter="" > <ul className="nav nav-pills nav-stacked" > <AdminSidebarCategory definitionKey="about" icon={ <InformationOutlineIcon color="currentColor" size={16} /> } key="about" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="About" id="admin.sidebar.about" /> } > <AdminSidebarSection definitionKey="about.license" key="about.license" name="about/license" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Edition and License" id="admin.sidebar.license" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="reporting" icon={ <ChartBarIcon color="currentColor" size={16} /> } key="reporting" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Reporting" id="admin.sidebar.reporting" /> } > <AdminSidebarSection definitionKey="reporting.workspace_optimization" key="reporting.workspace_optimization" name="reporting/workspace_optimization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Workspace Optimization" id="admin.sidebar.workspaceOptimization" /> } /> <AdminSidebarSection definitionKey="reporting.system_analytics" key="reporting.system_analytics" name="reporting/system_analytics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Statistics" id="admin.sidebar.siteStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.team_statistics" key="reporting.team_statistics" name="reporting/team_statistics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Team Statistics" id="admin.sidebar.teamStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.server_logs" key="reporting.server_logs" name="reporting/server_logs" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Logs" id="admin.sidebar.logs" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="user_management" icon={ <AccountMultipleOutlineIcon color="currentColor" size={16} /> } key="user_management" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="User Management" id="admin.sidebar.userManagement" /> } > <AdminSidebarSection definitionKey="user_management.system_users" key="user_management.system_users" name="user_management/users" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users" id="admin.sidebar.users" /> } /> <AdminSidebarSection definitionKey="user_management.teams" key="user_management.teams" name="user_management/teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Teams" id="admin.sidebar.teams" /> } /> <AdminSidebarSection definitionKey="user_management.channel" key="user_management.channel" name="user_management/channels" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Channels" id="admin.sidebar.channels" /> } /> <AdminSidebarSection definitionKey="user_management.permissions" key="user_management.permissions" name="user_management/permissions/" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Permissions" id="admin.sidebar.permissions" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="environment" icon={ <ServerVariantIcon color="currentColor" size={16} /> } key="environment" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Environment" id="admin.sidebar.environment" /> } > <AdminSidebarSection definitionKey="environment.web_server" key="environment.web_server" name="environment/web_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Web Server" id="admin.sidebar.webServer" /> } /> <AdminSidebarSection definitionKey="environment.database" key="environment.database" name="environment/database" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Database" id="admin.sidebar.database" /> } /> <AdminSidebarSection definitionKey="environment.storage" key="environment.storage" name="environment/file_storage" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Storage" id="admin.sidebar.fileStorage" /> } /> <AdminSidebarSection definitionKey="environment.image_proxy" key="environment.image_proxy" name="environment/image_proxy" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Image Proxy" id="admin.sidebar.imageProxy" /> } /> <AdminSidebarSection definitionKey="environment.smtp" key="environment.smtp" name="environment/smtp" title={ <Memo(MemoizedFormattedMessage) defaultMessage="SMTP" id="admin.sidebar.smtp" /> } /> <AdminSidebarSection definitionKey="environment.push_notification_server" key="environment.push_notification_server" name="environment/push_notification_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Push Notification Server" id="admin.sidebar.pushNotificationServer" /> } /> <AdminSidebarSection definitionKey="environment.rate_limiting" key="environment.rate_limiting" name="environment/rate_limiting" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Rate Limiting" id="admin.sidebar.rateLimiting" /> } /> <AdminSidebarSection definitionKey="environment.logging" key="environment.logging" name="environment/logging" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Logging" id="admin.sidebar.logging" /> } /> <AdminSidebarSection definitionKey="environment.session_lengths" key="environment.session_lengths" name="environment/session_lengths" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Session Lengths" id="admin.sidebar.sessionLengths" /> } /> <AdminSidebarSection definitionKey="environment.metrics" key="environment.metrics" name="environment/performance_monitoring" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Performance Monitoring" id="admin.sidebar.metrics" /> } /> <AdminSidebarSection definitionKey="environment.developer" key="environment.developer" name="environment/developer" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Developer" id="admin.sidebar.developer" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="site" icon={ <CogOutlineIcon color="currentColor" size={16} /> } key="site" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Configuration" id="admin.sidebar.site" /> } > <AdminSidebarSection definitionKey="site.customization" key="site.customization" name="site_config/customization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Customization" id="admin.sidebar.customization" /> } /> <AdminSidebarSection definitionKey="site.localization" key="site.localization" name="site_config/localization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Localization" id="admin.sidebar.localization" /> } /> <AdminSidebarSection definitionKey="site.users_and_teams" key="site.users_and_teams" name="site_config/users_and_teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users and Teams" id="admin.sidebar.usersAndTeams" /> } /> <AdminSidebarSection definitionKey="site.notifications" key="site.notifications" name="environment/notifications" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notifications" id="admin.sidebar.notifications" /> } /> <AdminSidebarSection definitionKey="site.emoji" key="site.emoji" name="site_config/emoji" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Emoji" id="admin.sidebar.emoji" /> } /> <AdminSidebarSection definitionKey="site.posts" key="site.posts" name="site_config/posts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Posts" id="admin.sidebar.posts" /> } /> <AdminSidebarSection definitionKey="site.file_sharing_downloads" key="site.file_sharing_downloads" name="site_config/file_sharing_downloads" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Sharing and Downloads" id="admin.sidebar.fileSharingDownloads" /> } /> <AdminSidebarSection definitionKey="site.public_links" key="site.public_links" name="site_config/public_links" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Public Links" id="admin.sidebar.publicLinks" /> } /> <AdminSidebarSection definitionKey="site.notices" key="site.notices" name="site_config/notices" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notices" id="admin.sidebar.notices" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="authentication" icon={ <ShieldOutlineIcon color="currentColor" size={16} /> } key="authentication" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Authentication" id="admin.sidebar.authentication" /> } > <AdminSidebarSection definitionKey="authentication.signup" key="authentication.signup" name="authentication/signup" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Signup" id="admin.sidebar.signup" /> } /> <AdminSidebarSection definitionKey="authentication.email" key="authentication.email" name="authentication/email" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Email" id="admin.sidebar.email" /> } /> <AdminSidebarSection definitionKey="authentication.password" key="authentication.password" name="authentication/password" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Password" id="admin.sidebar.password" /> } /> <AdminSidebarSection definitionKey="authentication.mfa" key="authentication.mfa" name="authentication/mfa" title={ <Memo(MemoizedFormattedMessage) defaultMessage="MFA" id="admin.sidebar.mfa" /> } /> <AdminSidebarSection definitionKey="authentication.gitlab" key="authentication.gitlab" name="authentication/gitlab" title={ <Memo(MemoizedFormattedMessage) defaultMessage="GitLab" id="admin.sidebar.gitlab" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="plugins" icon={ <PowerPlugOutlineIcon color="currentColor" size={16} /> } key="plugins" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugins" id="admin.sidebar.plugins" /> } > <AdminSidebarSection definitionKey="plugins.plugin_management" key="plugins.plugin_management" name="plugins/plugin_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugin Management" id="admin.plugins.pluginManagement" /> } /> <AdminSidebarSection key="custompluginplugin_0" name="plugins/plugin_plugin_0" title="Plugin 0" /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="integrations" icon={ <SitemapIcon color="currentColor" size={16} /> } key="integrations" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integrations" id="admin.sidebar.integrations" /> } > <AdminSidebarSection definitionKey="integrations.integration_management" key="integrations.integration_management" name="integrations/integration_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integration Management" id="admin.integrations.integrationManagement" /> } /> <AdminSidebarSection definitionKey="integrations.bot_accounts" key="integrations.bot_accounts" name="integrations/bot_accounts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bot Accounts" id="admin.integrations.botAccounts" /> } /> <AdminSidebarSection definitionKey="integrations.gif" key="integrations.gif" name="integrations/gif" title={ <Memo(MemoizedFormattedMessage) defaultMessage="GIF (Beta)" id="admin.sidebar.gif" /> } /> <AdminSidebarSection definitionKey="integrations.cors" key="integrations.cors" name="integrations/cors" title={ <Memo(MemoizedFormattedMessage) defaultMessage="CORS" id="admin.sidebar.cors" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="experimental" icon={ <FlaskOutlineIcon color="currentColor" size={16} /> } key="experimental" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Experimental" id="admin.sidebar.experimental" /> } > <AdminSidebarSection definitionKey="experimental.experimental_features" key="experimental.experimental_features" name="experimental/features" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Features" id="admin.sidebar.experimentalFeatures" /> } /> <AdminSidebarSection definitionKey="experimental.feature_flags" key="experimental.feature_flags" name="experimental/feature_flags" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Feature Flags" id="admin.feature_flags.title" /> } /> <AdminSidebarSection definitionKey="experimental.bleve" key="experimental.bleve" name="experimental/blevesearch" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bleve" id="admin.sidebar.blevesearch" /> } /> </AdminSidebarCategory> </ul> </Highlight> </div> </Scrollbars> </div> `; exports[`components/AdminSidebar should match snapshot with workspace optimization dashboard enabled 1`] = ` <div className="admin-sidebar" > <Connect(SidebarHeader) /> <div className="filter-container" > <SearchIcon aria-hidden="true" className="search__icon" /> <QuickInput className="filter " clearable={true} id="adminSidebarFilter" onChange={[Function]} onClear={[Function]} placeholder="Find settings" type="text" value="" /> </div> <Scrollbars autoHeight={false} autoHeightMax={200} autoHeightMin={0} autoHide={true} autoHideDuration={500} autoHideTimeout={500} hideTracksWhenNotNeeded={false} renderThumbHorizontal={[Function]} renderThumbVertical={[Function]} renderTrackHorizontal={[Function]} renderTrackVertical={[Function]} renderView={[Function]} tagName="div" thumbMinSize={30} universal={false} > <div className="nav-pills__container" > <Highlight filter="" > <ul className="nav nav-pills nav-stacked" > <AdminSidebarCategory definitionKey="about" icon={ <InformationOutlineIcon color="currentColor" size={16} /> } key="about" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="About" id="admin.sidebar.about" /> } > <AdminSidebarSection definitionKey="about.license" key="about.license" name="about/license" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Edition and License" id="admin.sidebar.license" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="reporting" icon={ <ChartBarIcon color="currentColor" size={16} /> } key="reporting" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Reporting" id="admin.sidebar.reporting" /> } > <AdminSidebarSection definitionKey="reporting.workspace_optimization" key="reporting.workspace_optimization" name="reporting/workspace_optimization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Workspace Optimization" id="admin.sidebar.workspaceOptimization" /> } /> <AdminSidebarSection definitionKey="reporting.system_analytics" key="reporting.system_analytics" name="reporting/system_analytics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Statistics" id="admin.sidebar.siteStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.team_statistics" key="reporting.team_statistics" name="reporting/team_statistics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Team Statistics" id="admin.sidebar.teamStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.server_logs" key="reporting.server_logs" name="reporting/server_logs" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Logs" id="admin.sidebar.logs" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="user_management" icon={ <AccountMultipleOutlineIcon color="currentColor" size={16} /> } key="user_management" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="User Management" id="admin.sidebar.userManagement" /> } > <AdminSidebarSection definitionKey="user_management.system_users" key="user_management.system_users" name="user_management/users" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users" id="admin.sidebar.users" /> } /> <AdminSidebarSection definitionKey="user_management.teams" key="user_management.teams" name="user_management/teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Teams" id="admin.sidebar.teams" /> } /> <AdminSidebarSection definitionKey="user_management.channel" key="user_management.channel" name="user_management/channels" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Channels" id="admin.sidebar.channels" /> } /> <AdminSidebarSection definitionKey="user_management.permissions" key="user_management.permissions" name="user_management/permissions/" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Permissions" id="admin.sidebar.permissions" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="environment" icon={ <ServerVariantIcon color="currentColor" size={16} /> } key="environment" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Environment" id="admin.sidebar.environment" /> } > <AdminSidebarSection definitionKey="environment.web_server" key="environment.web_server" name="environment/web_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Web Server" id="admin.sidebar.webServer" /> } /> <AdminSidebarSection definitionKey="environment.database" key="environment.database" name="environment/database" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Database" id="admin.sidebar.database" /> } /> <AdminSidebarSection definitionKey="environment.storage" key="environment.storage" name="environment/file_storage" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Storage" id="admin.sidebar.fileStorage" /> } /> <AdminSidebarSection definitionKey="environment.image_proxy" key="environment.image_proxy" name="environment/image_proxy" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Image Proxy" id="admin.sidebar.imageProxy" /> } /> <AdminSidebarSection definitionKey="environment.smtp" key="environment.smtp" name="environment/smtp" title={ <Memo(MemoizedFormattedMessage) defaultMessage="SMTP" id="admin.sidebar.smtp" /> } /> <AdminSidebarSection definitionKey="environment.push_notification_server" key="environment.push_notification_server" name="environment/push_notification_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Push Notification Server" id="admin.sidebar.pushNotificationServer" /> } /> <AdminSidebarSection definitionKey="environment.rate_limiting" key="environment.rate_limiting" name="environment/rate_limiting" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Rate Limiting" id="admin.sidebar.rateLimiting" /> } /> <AdminSidebarSection definitionKey="environment.logging" key="environment.logging" name="environment/logging" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Logging" id="admin.sidebar.logging" /> } /> <AdminSidebarSection definitionKey="environment.session_lengths" key="environment.session_lengths" name="environment/session_lengths" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Session Lengths" id="admin.sidebar.sessionLengths" /> } /> <AdminSidebarSection definitionKey="environment.metrics" key="environment.metrics" name="environment/performance_monitoring" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Performance Monitoring" id="admin.sidebar.metrics" /> } /> <AdminSidebarSection definitionKey="environment.developer" key="environment.developer" name="environment/developer" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Developer" id="admin.sidebar.developer" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="site" icon={ <CogOutlineIcon color="currentColor" size={16} /> } key="site" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Configuration" id="admin.sidebar.site" /> } > <AdminSidebarSection definitionKey="site.customization" key="site.customization" name="site_config/customization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Customization" id="admin.sidebar.customization" /> } /> <AdminSidebarSection definitionKey="site.localization" key="site.localization" name="site_config/localization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Localization" id="admin.sidebar.localization" /> } /> <AdminSidebarSection definitionKey="site.users_and_teams" key="site.users_and_teams" name="site_config/users_and_teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users and Teams" id="admin.sidebar.usersAndTeams" /> } /> <AdminSidebarSection definitionKey="site.notifications" key="site.notifications" name="environment/notifications" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notifications" id="admin.sidebar.notifications" /> } /> <AdminSidebarSection definitionKey="site.emoji" key="site.emoji" name="site_config/emoji" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Emoji" id="admin.sidebar.emoji" /> } /> <AdminSidebarSection definitionKey="site.posts" key="site.posts" name="site_config/posts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Posts" id="admin.sidebar.posts" /> } /> <AdminSidebarSection definitionKey="site.file_sharing_downloads" key="site.file_sharing_downloads" name="site_config/file_sharing_downloads" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Sharing and Downloads" id="admin.sidebar.fileSharingDownloads" /> } /> <AdminSidebarSection definitionKey="site.public_links" key="site.public_links" name="site_config/public_links" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Public Links" id="admin.sidebar.publicLinks" /> } /> <AdminSidebarSection definitionKey="site.notices" key="site.notices" name="site_config/notices" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notices" id="admin.sidebar.notices" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="authentication" icon={ <ShieldOutlineIcon color="currentColor" size={16} /> } key="authentication" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Authentication" id="admin.sidebar.authentication" /> } > <AdminSidebarSection definitionKey="authentication.signup" key="authentication.signup" name="authentication/signup" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Signup" id="admin.sidebar.signup" /> } /> <AdminSidebarSection definitionKey="authentication.email" key="authentication.email" name="authentication/email" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Email" id="admin.sidebar.email" /> } /> <AdminSidebarSection definitionKey="authentication.password" key="authentication.password" name="authentication/password" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Password" id="admin.sidebar.password" /> } /> <AdminSidebarSection definitionKey="authentication.mfa" key="authentication.mfa" name="authentication/mfa" title={ <Memo(MemoizedFormattedMessage) defaultMessage="MFA" id="admin.sidebar.mfa" /> } /> <AdminSidebarSection definitionKey="authentication.gitlab" key="authentication.gitlab" name="authentication/gitlab" title={ <Memo(MemoizedFormattedMessage) defaultMessage="GitLab" id="admin.sidebar.gitlab" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="plugins" icon={ <PowerPlugOutlineIcon color="currentColor" size={16} /> } key="plugins" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugins" id="admin.sidebar.plugins" /> } > <AdminSidebarSection definitionKey="plugins.plugin_management" key="plugins.plugin_management" name="plugins/plugin_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugin Management" id="admin.plugins.pluginManagement" /> } /> <AdminSidebarSection key="custompluginplugin_0" name="plugins/plugin_plugin_0" title="Plugin 0" /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="integrations" icon={ <SitemapIcon color="currentColor" size={16} /> } key="integrations" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integrations" id="admin.sidebar.integrations" /> } > <AdminSidebarSection definitionKey="integrations.integration_management" key="integrations.integration_management" name="integrations/integration_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integration Management" id="admin.integrations.integrationManagement" /> } /> <AdminSidebarSection definitionKey="integrations.bot_accounts" key="integrations.bot_accounts" name="integrations/bot_accounts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bot Accounts" id="admin.integrations.botAccounts" /> } /> <AdminSidebarSection definitionKey="integrations.gif" key="integrations.gif" name="integrations/gif" title={ <Memo(MemoizedFormattedMessage) defaultMessage="GIF (Beta)" id="admin.sidebar.gif" /> } /> <AdminSidebarSection definitionKey="integrations.cors" key="integrations.cors" name="integrations/cors" title={ <Memo(MemoizedFormattedMessage) defaultMessage="CORS" id="admin.sidebar.cors" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="experimental" icon={ <FlaskOutlineIcon color="currentColor" size={16} /> } key="experimental" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Experimental" id="admin.sidebar.experimental" /> } > <AdminSidebarSection definitionKey="experimental.experimental_features" key="experimental.experimental_features" name="experimental/features" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Features" id="admin.sidebar.experimentalFeatures" /> } /> <AdminSidebarSection definitionKey="experimental.feature_flags" key="experimental.feature_flags" name="experimental/feature_flags" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Feature Flags" id="admin.feature_flags.title" /> } /> <AdminSidebarSection definitionKey="experimental.bleve" key="experimental.bleve" name="experimental/blevesearch" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bleve" id="admin.sidebar.blevesearch" /> } /> </AdminSidebarCategory> </ul> </Highlight> </div> </Scrollbars> </div> `; exports[`components/AdminSidebar should match snapshot, no access 1`] = ` <div className="admin-sidebar" > <Connect(SidebarHeader) /> <div className="filter-container" > <SearchIcon aria-hidden="true" className="search__icon" /> <QuickInput className="filter " clearable={true} id="adminSidebarFilter" onChange={[Function]} onClear={[Function]} placeholder="Find settings" type="text" value="" /> </div> <Scrollbars autoHeight={false} autoHeightMax={200} autoHeightMin={0} autoHide={true} autoHideDuration={500} autoHideTimeout={500} hideTracksWhenNotNeeded={false} renderThumbHorizontal={[Function]} renderThumbVertical={[Function]} renderTrackHorizontal={[Function]} renderTrackVertical={[Function]} renderView={[Function]} tagName="div" thumbMinSize={30} universal={false} > <div className="nav-pills__container" > <Highlight filter="" > <ul className="nav nav-pills nav-stacked" /> </Highlight> </div> </Scrollbars> </div> `; exports[`components/AdminSidebar should match snapshot, not prevent the console from loading when empty settings_schema provided 1`] = ` <div className="admin-sidebar" > <Connect(SidebarHeader) /> <div className="filter-container" > <SearchIcon aria-hidden="true" className="search__icon" /> <QuickInput className="filter " clearable={true} id="adminSidebarFilter" onChange={[Function]} onClear={[Function]} placeholder="Find settings" type="text" value="" /> </div> <Scrollbars autoHeight={false} autoHeightMax={200} autoHeightMin={0} autoHide={true} autoHideDuration={500} autoHideTimeout={500} hideTracksWhenNotNeeded={false} renderThumbHorizontal={[Function]} renderThumbVertical={[Function]} renderTrackHorizontal={[Function]} renderTrackVertical={[Function]} renderView={[Function]} tagName="div" thumbMinSize={30} universal={false} > <div className="nav-pills__container" > <Highlight filter="" > <ul className="nav nav-pills nav-stacked" > <AdminSidebarCategory definitionKey="about" icon={ <InformationOutlineIcon color="currentColor" size={16} /> } key="about" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="About" id="admin.sidebar.about" /> } > <AdminSidebarSection definitionKey="about.license" key="about.license" name="about/license" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Edition and License" id="admin.sidebar.license" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="reporting" icon={ <ChartBarIcon color="currentColor" size={16} /> } key="reporting" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Reporting" id="admin.sidebar.reporting" /> } > <AdminSidebarSection definitionKey="reporting.workspace_optimization" key="reporting.workspace_optimization" name="reporting/workspace_optimization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Workspace Optimization" id="admin.sidebar.workspaceOptimization" /> } /> <AdminSidebarSection definitionKey="reporting.system_analytics" key="reporting.system_analytics" name="reporting/system_analytics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Statistics" id="admin.sidebar.siteStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.team_statistics" key="reporting.team_statistics" name="reporting/team_statistics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Team Statistics" id="admin.sidebar.teamStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.server_logs" key="reporting.server_logs" name="reporting/server_logs" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Logs" id="admin.sidebar.logs" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="user_management" icon={ <AccountMultipleOutlineIcon color="currentColor" size={16} /> } key="user_management" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="User Management" id="admin.sidebar.userManagement" /> } > <AdminSidebarSection definitionKey="user_management.system_users" key="user_management.system_users" name="user_management/users" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users" id="admin.sidebar.users" /> } /> <AdminSidebarSection definitionKey="user_management.teams" key="user_management.teams" name="user_management/teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Teams" id="admin.sidebar.teams" /> } /> <AdminSidebarSection definitionKey="user_management.channel" key="user_management.channel" name="user_management/channels" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Channels" id="admin.sidebar.channels" /> } /> <AdminSidebarSection definitionKey="user_management.permissions" key="user_management.permissions" name="user_management/permissions/" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Permissions" id="admin.sidebar.permissions" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="environment" icon={ <ServerVariantIcon color="currentColor" size={16} /> } key="environment" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Environment" id="admin.sidebar.environment" /> } > <AdminSidebarSection definitionKey="environment.web_server" key="environment.web_server" name="environment/web_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Web Server" id="admin.sidebar.webServer" /> } /> <AdminSidebarSection definitionKey="environment.database" key="environment.database" name="environment/database" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Database" id="admin.sidebar.database" /> } /> <AdminSidebarSection definitionKey="environment.storage" key="environment.storage" name="environment/file_storage" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Storage" id="admin.sidebar.fileStorage" /> } /> <AdminSidebarSection definitionKey="environment.image_proxy" key="environment.image_proxy" name="environment/image_proxy" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Image Proxy" id="admin.sidebar.imageProxy" /> } /> <AdminSidebarSection definitionKey="environment.smtp" key="environment.smtp" name="environment/smtp" title={ <Memo(MemoizedFormattedMessage) defaultMessage="SMTP" id="admin.sidebar.smtp" /> } /> <AdminSidebarSection definitionKey="environment.push_notification_server" key="environment.push_notification_server" name="environment/push_notification_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Push Notification Server" id="admin.sidebar.pushNotificationServer" /> } /> <AdminSidebarSection definitionKey="environment.rate_limiting" key="environment.rate_limiting" name="environment/rate_limiting" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Rate Limiting" id="admin.sidebar.rateLimiting" /> } /> <AdminSidebarSection definitionKey="environment.logging" key="environment.logging" name="environment/logging" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Logging" id="admin.sidebar.logging" /> } /> <AdminSidebarSection definitionKey="environment.session_lengths" key="environment.session_lengths" name="environment/session_lengths" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Session Lengths" id="admin.sidebar.sessionLengths" /> } /> <AdminSidebarSection definitionKey="environment.metrics" key="environment.metrics" name="environment/performance_monitoring" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Performance Monitoring" id="admin.sidebar.metrics" /> } /> <AdminSidebarSection definitionKey="environment.developer" key="environment.developer" name="environment/developer" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Developer" id="admin.sidebar.developer" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="site" icon={ <CogOutlineIcon color="currentColor" size={16} /> } key="site" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Configuration" id="admin.sidebar.site" /> } > <AdminSidebarSection definitionKey="site.customization" key="site.customization" name="site_config/customization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Customization" id="admin.sidebar.customization" /> } /> <AdminSidebarSection definitionKey="site.localization" key="site.localization" name="site_config/localization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Localization" id="admin.sidebar.localization" /> } /> <AdminSidebarSection definitionKey="site.users_and_teams" key="site.users_and_teams" name="site_config/users_and_teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users and Teams" id="admin.sidebar.usersAndTeams" /> } /> <AdminSidebarSection definitionKey="site.notifications" key="site.notifications" name="environment/notifications" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notifications" id="admin.sidebar.notifications" /> } /> <AdminSidebarSection definitionKey="site.emoji" key="site.emoji" name="site_config/emoji" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Emoji" id="admin.sidebar.emoji" /> } /> <AdminSidebarSection definitionKey="site.posts" key="site.posts" name="site_config/posts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Posts" id="admin.sidebar.posts" /> } /> <AdminSidebarSection definitionKey="site.file_sharing_downloads" key="site.file_sharing_downloads" name="site_config/file_sharing_downloads" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Sharing and Downloads" id="admin.sidebar.fileSharingDownloads" /> } /> <AdminSidebarSection definitionKey="site.public_links" key="site.public_links" name="site_config/public_links" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Public Links" id="admin.sidebar.publicLinks" /> } /> <AdminSidebarSection definitionKey="site.notices" key="site.notices" name="site_config/notices" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notices" id="admin.sidebar.notices" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="authentication" icon={ <ShieldOutlineIcon color="currentColor" size={16} /> } key="authentication" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Authentication" id="admin.sidebar.authentication" /> } > <AdminSidebarSection definitionKey="authentication.signup" key="authentication.signup" name="authentication/signup" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Signup" id="admin.sidebar.signup" /> } /> <AdminSidebarSection definitionKey="authentication.email" key="authentication.email" name="authentication/email" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Email" id="admin.sidebar.email" /> } /> <AdminSidebarSection definitionKey="authentication.password" key="authentication.password" name="authentication/password" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Password" id="admin.sidebar.password" /> } /> <AdminSidebarSection definitionKey="authentication.mfa" key="authentication.mfa" name="authentication/mfa" title={ <Memo(MemoizedFormattedMessage) defaultMessage="MFA" id="admin.sidebar.mfa" /> } /> <AdminSidebarSection definitionKey="authentication.gitlab" key="authentication.gitlab" name="authentication/gitlab" title={ <Memo(MemoizedFormattedMessage) defaultMessage="GitLab" id="admin.sidebar.gitlab" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="plugins" icon={ <PowerPlugOutlineIcon color="currentColor" size={16} /> } key="plugins" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugins" id="admin.sidebar.plugins" /> } > <AdminSidebarSection definitionKey="plugins.plugin_management" key="plugins.plugin_management" name="plugins/plugin_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugin Management" id="admin.plugins.pluginManagement" /> } /> <AdminSidebarSection key="custompluginplugin_0" name="plugins/plugin_plugin_0" title="Plugin 0" /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="integrations" icon={ <SitemapIcon color="currentColor" size={16} /> } key="integrations" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integrations" id="admin.sidebar.integrations" /> } > <AdminSidebarSection definitionKey="integrations.integration_management" key="integrations.integration_management" name="integrations/integration_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integration Management" id="admin.integrations.integrationManagement" /> } /> <AdminSidebarSection definitionKey="integrations.bot_accounts" key="integrations.bot_accounts" name="integrations/bot_accounts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bot Accounts" id="admin.integrations.botAccounts" /> } /> <AdminSidebarSection definitionKey="integrations.gif" key="integrations.gif" name="integrations/gif" title={ <Memo(MemoizedFormattedMessage) defaultMessage="GIF (Beta)" id="admin.sidebar.gif" /> } /> <AdminSidebarSection definitionKey="integrations.cors" key="integrations.cors" name="integrations/cors" title={ <Memo(MemoizedFormattedMessage) defaultMessage="CORS" id="admin.sidebar.cors" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="experimental" icon={ <FlaskOutlineIcon color="currentColor" size={16} /> } key="experimental" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Experimental" id="admin.sidebar.experimental" /> } > <AdminSidebarSection definitionKey="experimental.experimental_features" key="experimental.experimental_features" name="experimental/features" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Features" id="admin.sidebar.experimentalFeatures" /> } /> <AdminSidebarSection definitionKey="experimental.feature_flags" key="experimental.feature_flags" name="experimental/feature_flags" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Feature Flags" id="admin.feature_flags.title" /> } /> <AdminSidebarSection definitionKey="experimental.bleve" key="experimental.bleve" name="experimental/blevesearch" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bleve" id="admin.sidebar.blevesearch" /> } /> </AdminSidebarCategory> </ul> </Highlight> </div> </Scrollbars> </div> `; exports[`components/AdminSidebar should match snapshot, render plugins without any settings as well 1`] = ` <div className="admin-sidebar" > <Connect(SidebarHeader) /> <div className="filter-container" > <SearchIcon aria-hidden="true" className="search__icon" /> <QuickInput className="filter " clearable={true} id="adminSidebarFilter" onChange={[Function]} onClear={[Function]} placeholder="Find settings" type="text" value="" /> </div> <Scrollbars autoHeight={false} autoHeightMax={200} autoHeightMin={0} autoHide={true} autoHideDuration={500} autoHideTimeout={500} hideTracksWhenNotNeeded={false} renderThumbHorizontal={[Function]} renderThumbVertical={[Function]} renderTrackHorizontal={[Function]} renderTrackVertical={[Function]} renderView={[Function]} tagName="div" thumbMinSize={30} universal={false} > <div className="nav-pills__container" > <Highlight filter="" > <ul className="nav nav-pills nav-stacked" > <AdminSidebarCategory definitionKey="about" icon={ <InformationOutlineIcon color="currentColor" size={16} /> } key="about" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="About" id="admin.sidebar.about" /> } > <AdminSidebarSection definitionKey="about.license" key="about.license" name="about/license" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Edition and License" id="admin.sidebar.license" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="reporting" icon={ <ChartBarIcon color="currentColor" size={16} /> } key="reporting" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Reporting" id="admin.sidebar.reporting" /> } > <AdminSidebarSection definitionKey="reporting.workspace_optimization" key="reporting.workspace_optimization" name="reporting/workspace_optimization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Workspace Optimization" id="admin.sidebar.workspaceOptimization" /> } /> <AdminSidebarSection definitionKey="reporting.system_analytics" key="reporting.system_analytics" name="reporting/system_analytics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Statistics" id="admin.sidebar.siteStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.team_statistics" key="reporting.team_statistics" name="reporting/team_statistics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Team Statistics" id="admin.sidebar.teamStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.server_logs" key="reporting.server_logs" name="reporting/server_logs" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Logs" id="admin.sidebar.logs" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="user_management" icon={ <AccountMultipleOutlineIcon color="currentColor" size={16} /> } key="user_management" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="User Management" id="admin.sidebar.userManagement" /> } > <AdminSidebarSection definitionKey="user_management.system_users" key="user_management.system_users" name="user_management/users" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users" id="admin.sidebar.users" /> } /> <AdminSidebarSection definitionKey="user_management.teams" key="user_management.teams" name="user_management/teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Teams" id="admin.sidebar.teams" /> } /> <AdminSidebarSection definitionKey="user_management.channel" key="user_management.channel" name="user_management/channels" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Channels" id="admin.sidebar.channels" /> } /> <AdminSidebarSection definitionKey="user_management.permissions" key="user_management.permissions" name="user_management/permissions/" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Permissions" id="admin.sidebar.permissions" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="environment" icon={ <ServerVariantIcon color="currentColor" size={16} /> } key="environment" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Environment" id="admin.sidebar.environment" /> } > <AdminSidebarSection definitionKey="environment.web_server" key="environment.web_server" name="environment/web_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Web Server" id="admin.sidebar.webServer" /> } /> <AdminSidebarSection definitionKey="environment.database" key="environment.database" name="environment/database" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Database" id="admin.sidebar.database" /> } /> <AdminSidebarSection definitionKey="environment.storage" key="environment.storage" name="environment/file_storage" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Storage" id="admin.sidebar.fileStorage" /> } /> <AdminSidebarSection definitionKey="environment.image_proxy" key="environment.image_proxy" name="environment/image_proxy" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Image Proxy" id="admin.sidebar.imageProxy" /> } /> <AdminSidebarSection definitionKey="environment.smtp" key="environment.smtp" name="environment/smtp" title={ <Memo(MemoizedFormattedMessage) defaultMessage="SMTP" id="admin.sidebar.smtp" /> } /> <AdminSidebarSection definitionKey="environment.push_notification_server" key="environment.push_notification_server" name="environment/push_notification_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Push Notification Server" id="admin.sidebar.pushNotificationServer" /> } /> <AdminSidebarSection definitionKey="environment.rate_limiting" key="environment.rate_limiting" name="environment/rate_limiting" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Rate Limiting" id="admin.sidebar.rateLimiting" /> } /> <AdminSidebarSection definitionKey="environment.logging" key="environment.logging" name="environment/logging" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Logging" id="admin.sidebar.logging" /> } /> <AdminSidebarSection definitionKey="environment.session_lengths" key="environment.session_lengths" name="environment/session_lengths" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Session Lengths" id="admin.sidebar.sessionLengths" /> } /> <AdminSidebarSection definitionKey="environment.metrics" key="environment.metrics" name="environment/performance_monitoring" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Performance Monitoring" id="admin.sidebar.metrics" /> } /> <AdminSidebarSection definitionKey="environment.developer" key="environment.developer" name="environment/developer" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Developer" id="admin.sidebar.developer" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="site" icon={ <CogOutlineIcon color="currentColor" size={16} /> } key="site" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Configuration" id="admin.sidebar.site" /> } > <AdminSidebarSection definitionKey="site.customization" key="site.customization" name="site_config/customization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Customization" id="admin.sidebar.customization" /> } /> <AdminSidebarSection definitionKey="site.localization" key="site.localization" name="site_config/localization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Localization" id="admin.sidebar.localization" /> } /> <AdminSidebarSection definitionKey="site.users_and_teams" key="site.users_and_teams" name="site_config/users_and_teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users and Teams" id="admin.sidebar.usersAndTeams" /> } /> <AdminSidebarSection definitionKey="site.notifications" key="site.notifications" name="environment/notifications" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notifications" id="admin.sidebar.notifications" /> } /> <AdminSidebarSection definitionKey="site.emoji" key="site.emoji" name="site_config/emoji" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Emoji" id="admin.sidebar.emoji" /> } /> <AdminSidebarSection definitionKey="site.posts" key="site.posts" name="site_config/posts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Posts" id="admin.sidebar.posts" /> } /> <AdminSidebarSection definitionKey="site.file_sharing_downloads" key="site.file_sharing_downloads" name="site_config/file_sharing_downloads" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Sharing and Downloads" id="admin.sidebar.fileSharingDownloads" /> } /> <AdminSidebarSection definitionKey="site.public_links" key="site.public_links" name="site_config/public_links" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Public Links" id="admin.sidebar.publicLinks" /> } /> <AdminSidebarSection definitionKey="site.notices" key="site.notices" name="site_config/notices" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notices" id="admin.sidebar.notices" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="authentication" icon={ <ShieldOutlineIcon color="currentColor" size={16} /> } key="authentication" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Authentication" id="admin.sidebar.authentication" /> } > <AdminSidebarSection definitionKey="authentication.signup" key="authentication.signup" name="authentication/signup" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Signup" id="admin.sidebar.signup" /> } /> <AdminSidebarSection definitionKey="authentication.email" key="authentication.email" name="authentication/email" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Email" id="admin.sidebar.email" /> } /> <AdminSidebarSection definitionKey="authentication.password" key="authentication.password" name="authentication/password" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Password" id="admin.sidebar.password" /> } /> <AdminSidebarSection definitionKey="authentication.mfa" key="authentication.mfa" name="authentication/mfa" title={ <Memo(MemoizedFormattedMessage) defaultMessage="MFA" id="admin.sidebar.mfa" /> } /> <AdminSidebarSection definitionKey="authentication.gitlab" key="authentication.gitlab" name="authentication/gitlab" title={ <Memo(MemoizedFormattedMessage) defaultMessage="GitLab" id="admin.sidebar.gitlab" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="plugins" icon={ <PowerPlugOutlineIcon color="currentColor" size={16} /> } key="plugins" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugins" id="admin.sidebar.plugins" /> } > <AdminSidebarSection definitionKey="plugins.plugin_management" key="plugins.plugin_management" name="plugins/plugin_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugin Management" id="admin.plugins.pluginManagement" /> } /> <AdminSidebarSection key="custompluginplugin_0" name="plugins/plugin_plugin_0" title="Plugin 0" /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="integrations" icon={ <SitemapIcon color="currentColor" size={16} /> } key="integrations" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integrations" id="admin.sidebar.integrations" /> } > <AdminSidebarSection definitionKey="integrations.integration_management" key="integrations.integration_management" name="integrations/integration_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integration Management" id="admin.integrations.integrationManagement" /> } /> <AdminSidebarSection definitionKey="integrations.bot_accounts" key="integrations.bot_accounts" name="integrations/bot_accounts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bot Accounts" id="admin.integrations.botAccounts" /> } /> <AdminSidebarSection definitionKey="integrations.gif" key="integrations.gif" name="integrations/gif" title={ <Memo(MemoizedFormattedMessage) defaultMessage="GIF (Beta)" id="admin.sidebar.gif" /> } /> <AdminSidebarSection definitionKey="integrations.cors" key="integrations.cors" name="integrations/cors" title={ <Memo(MemoizedFormattedMessage) defaultMessage="CORS" id="admin.sidebar.cors" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="experimental" icon={ <FlaskOutlineIcon color="currentColor" size={16} /> } key="experimental" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Experimental" id="admin.sidebar.experimental" /> } > <AdminSidebarSection definitionKey="experimental.experimental_features" key="experimental.experimental_features" name="experimental/features" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Features" id="admin.sidebar.experimentalFeatures" /> } /> <AdminSidebarSection definitionKey="experimental.feature_flags" key="experimental.feature_flags" name="experimental/feature_flags" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Feature Flags" id="admin.feature_flags.title" /> } /> <AdminSidebarSection definitionKey="experimental.bleve" key="experimental.bleve" name="experimental/blevesearch" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bleve" id="admin.sidebar.blevesearch" /> } /> </AdminSidebarCategory> </ul> </Highlight> </div> </Scrollbars> </div> `; exports[`components/AdminSidebar should match snapshot, with license (with all feature) 1`] = ` <div className="admin-sidebar" > <Connect(SidebarHeader) /> <div className="filter-container" > <SearchIcon aria-hidden="true" className="search__icon" /> <QuickInput className="filter " clearable={true} id="adminSidebarFilter" onChange={[Function]} onClear={[Function]} placeholder="Find settings" type="text" value="" /> </div> <Scrollbars autoHeight={false} autoHeightMax={200} autoHeightMin={0} autoHide={true} autoHideDuration={500} autoHideTimeout={500} hideTracksWhenNotNeeded={false} renderThumbHorizontal={[Function]} renderThumbVertical={[Function]} renderTrackHorizontal={[Function]} renderTrackVertical={[Function]} renderView={[Function]} tagName="div" thumbMinSize={30} universal={false} > <div className="nav-pills__container" > <Highlight filter="" > <ul className="nav nav-pills nav-stacked" > <AdminSidebarCategory definitionKey="about" icon={ <InformationOutlineIcon color="currentColor" size={16} /> } key="about" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="About" id="admin.sidebar.about" /> } > <AdminSidebarSection definitionKey="about.license" key="about.license" name="about/license" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Edition and License" id="admin.sidebar.license" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="reporting" icon={ <ChartBarIcon color="currentColor" size={16} /> } key="reporting" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Reporting" id="admin.sidebar.reporting" /> } > <AdminSidebarSection definitionKey="reporting.workspace_optimization" key="reporting.workspace_optimization" name="reporting/workspace_optimization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Workspace Optimization" id="admin.sidebar.workspaceOptimization" /> } /> <AdminSidebarSection definitionKey="reporting.system_analytics" key="reporting.system_analytics" name="reporting/system_analytics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Statistics" id="admin.sidebar.siteStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.team_statistics" key="reporting.team_statistics" name="reporting/team_statistics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Team Statistics" id="admin.sidebar.teamStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.server_logs" key="reporting.server_logs" name="reporting/server_logs" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Logs" id="admin.sidebar.logs" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="user_management" icon={ <AccountMultipleOutlineIcon color="currentColor" size={16} /> } key="user_management" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="User Management" id="admin.sidebar.userManagement" /> } > <AdminSidebarSection definitionKey="user_management.system_users" key="user_management.system_users" name="user_management/users" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users" id="admin.sidebar.users" /> } /> <AdminSidebarSection definitionKey="user_management.groups" key="user_management.groups" name="user_management/groups" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Groups" id="admin.sidebar.groups" /> } /> <AdminSidebarSection definitionKey="user_management.teams" key="user_management.teams" name="user_management/teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Teams" id="admin.sidebar.teams" /> } /> <AdminSidebarSection definitionKey="user_management.channel" key="user_management.channel" name="user_management/channels" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Channels" id="admin.sidebar.channels" /> } /> <AdminSidebarSection definitionKey="user_management.permissions" key="user_management.permissions" name="user_management/permissions/" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Permissions" id="admin.sidebar.permissions" /> } /> <AdminSidebarSection definitionKey="user_management.system_roles" key="user_management.system_roles" name="user_management/system_roles" title={ <Memo(MemoizedFormattedMessage) defaultMessage="System Roles" id="admin.sidebar.systemRoles" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="environment" icon={ <ServerVariantIcon color="currentColor" size={16} /> } key="environment" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Environment" id="admin.sidebar.environment" /> } > <AdminSidebarSection definitionKey="environment.web_server" key="environment.web_server" name="environment/web_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Web Server" id="admin.sidebar.webServer" /> } /> <AdminSidebarSection definitionKey="environment.database" key="environment.database" name="environment/database" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Database" id="admin.sidebar.database" /> } /> <AdminSidebarSection definitionKey="environment.elasticsearch" key="environment.elasticsearch" name="environment/elasticsearch" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Elasticsearch" id="admin.sidebar.elasticsearch" /> } /> <AdminSidebarSection definitionKey="environment.storage" key="environment.storage" name="environment/file_storage" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Storage" id="admin.sidebar.fileStorage" /> } /> <AdminSidebarSection definitionKey="environment.image_proxy" key="environment.image_proxy" name="environment/image_proxy" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Image Proxy" id="admin.sidebar.imageProxy" /> } /> <AdminSidebarSection definitionKey="environment.smtp" key="environment.smtp" name="environment/smtp" title={ <Memo(MemoizedFormattedMessage) defaultMessage="SMTP" id="admin.sidebar.smtp" /> } /> <AdminSidebarSection definitionKey="environment.push_notification_server" key="environment.push_notification_server" name="environment/push_notification_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Push Notification Server" id="admin.sidebar.pushNotificationServer" /> } /> <AdminSidebarSection definitionKey="environment.high_availability" key="environment.high_availability" name="environment/high_availability" title={ <Memo(MemoizedFormattedMessage) defaultMessage="High Availability" id="admin.sidebar.highAvailability" /> } /> <AdminSidebarSection definitionKey="environment.rate_limiting" key="environment.rate_limiting" name="environment/rate_limiting" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Rate Limiting" id="admin.sidebar.rateLimiting" /> } /> <AdminSidebarSection definitionKey="environment.logging" key="environment.logging" name="environment/logging" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Logging" id="admin.sidebar.logging" /> } /> <AdminSidebarSection definitionKey="environment.session_lengths" key="environment.session_lengths" name="environment/session_lengths" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Session Lengths" id="admin.sidebar.sessionLengths" /> } /> <AdminSidebarSection definitionKey="environment.metrics" key="environment.metrics" name="environment/performance_monitoring" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Performance Monitoring" id="admin.sidebar.metrics" /> } /> <AdminSidebarSection definitionKey="environment.developer" key="environment.developer" name="environment/developer" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Developer" id="admin.sidebar.developer" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="site" icon={ <CogOutlineIcon color="currentColor" size={16} /> } key="site" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Configuration" id="admin.sidebar.site" /> } > <AdminSidebarSection definitionKey="site.customization" key="site.customization" name="site_config/customization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Customization" id="admin.sidebar.customization" /> } /> <AdminSidebarSection definitionKey="site.localization" key="site.localization" name="site_config/localization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Localization" id="admin.sidebar.localization" /> } /> <AdminSidebarSection definitionKey="site.users_and_teams" key="site.users_and_teams" name="site_config/users_and_teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users and Teams" id="admin.sidebar.usersAndTeams" /> } /> <AdminSidebarSection definitionKey="site.notifications" key="site.notifications" name="environment/notifications" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notifications" id="admin.sidebar.notifications" /> } /> <AdminSidebarSection definitionKey="site.announcement_banner" key="site.announcement_banner" name="site_config/announcement_banner" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Announcement Banner" id="admin.sidebar.announcement" /> } /> <AdminSidebarSection definitionKey="site.emoji" key="site.emoji" name="site_config/emoji" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Emoji" id="admin.sidebar.emoji" /> } /> <AdminSidebarSection definitionKey="site.posts" key="site.posts" name="site_config/posts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Posts" id="admin.sidebar.posts" /> } /> <AdminSidebarSection definitionKey="site.file_sharing_downloads" key="site.file_sharing_downloads" name="site_config/file_sharing_downloads" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Sharing and Downloads" id="admin.sidebar.fileSharingDownloads" /> } /> <AdminSidebarSection definitionKey="site.public_links" key="site.public_links" name="site_config/public_links" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Public Links" id="admin.sidebar.publicLinks" /> } /> <AdminSidebarSection definitionKey="site.notices" key="site.notices" name="site_config/notices" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notices" id="admin.sidebar.notices" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="authentication" icon={ <ShieldOutlineIcon color="currentColor" size={16} /> } key="authentication" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Authentication" id="admin.sidebar.authentication" /> } > <AdminSidebarSection definitionKey="authentication.signup" key="authentication.signup" name="authentication/signup" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Signup" id="admin.sidebar.signup" /> } /> <AdminSidebarSection definitionKey="authentication.email" key="authentication.email" name="authentication/email" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Email" id="admin.sidebar.email" /> } /> <AdminSidebarSection definitionKey="authentication.password" key="authentication.password" name="authentication/password" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Password" id="admin.sidebar.password" /> } /> <AdminSidebarSection definitionKey="authentication.mfa" key="authentication.mfa" name="authentication/mfa" title={ <Memo(MemoizedFormattedMessage) defaultMessage="MFA" id="admin.sidebar.mfa" /> } /> <AdminSidebarSection definitionKey="authentication.ldap" key="authentication.ldap" name="authentication/ldap" title={ <Memo(MemoizedFormattedMessage) defaultMessage="AD/LDAP" id="admin.sidebar.ldap" /> } /> <AdminSidebarSection definitionKey="authentication.saml" key="authentication.saml" name="authentication/saml" title={ <Memo(MemoizedFormattedMessage) defaultMessage="SAML 2.0" id="admin.sidebar.saml" /> } /> <AdminSidebarSection definitionKey="authentication.oauth" key="authentication.oauth" name="authentication/oauth" title={ <Memo(MemoizedFormattedMessage) defaultMessage="OAuth 2.0" id="admin.sidebar.oauth" /> } /> <AdminSidebarSection definitionKey="authentication.openid" key="authentication.openid" name="authentication/openid" title={ <Memo(MemoizedFormattedMessage) defaultMessage="OpenID Connect" id="admin.sidebar.openid" /> } /> <AdminSidebarSection definitionKey="authentication.guest_access" key="authentication.guest_access" name="authentication/guest_access" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Guest Access" id="admin.sidebar.guest_access" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="plugins" icon={ <PowerPlugOutlineIcon color="currentColor" size={16} /> } key="plugins" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugins" id="admin.sidebar.plugins" /> } > <AdminSidebarSection definitionKey="plugins.plugin_management" key="plugins.plugin_management" name="plugins/plugin_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugin Management" id="admin.plugins.pluginManagement" /> } /> <AdminSidebarSection key="custompluginplugin_0" name="plugins/plugin_plugin_0" title="Plugin 0" /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="integrations" icon={ <SitemapIcon color="currentColor" size={16} /> } key="integrations" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integrations" id="admin.sidebar.integrations" /> } > <AdminSidebarSection definitionKey="integrations.integration_management" key="integrations.integration_management" name="integrations/integration_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integration Management" id="admin.integrations.integrationManagement" /> } /> <AdminSidebarSection definitionKey="integrations.bot_accounts" key="integrations.bot_accounts" name="integrations/bot_accounts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bot Accounts" id="admin.integrations.botAccounts" /> } /> <AdminSidebarSection definitionKey="integrations.gif" key="integrations.gif" name="integrations/gif" title={ <Memo(MemoizedFormattedMessage) defaultMessage="GIF (Beta)" id="admin.sidebar.gif" /> } /> <AdminSidebarSection definitionKey="integrations.cors" key="integrations.cors" name="integrations/cors" title={ <Memo(MemoizedFormattedMessage) defaultMessage="CORS" id="admin.sidebar.cors" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="compliance" icon={ <FormatListBulletedIcon color="currentColor" size={16} /> } key="compliance" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Compliance" id="admin.sidebar.compliance" /> } > <AdminSidebarSection definitionKey="compliance.data_retention" key="compliance.data_retention" name="compliance/data_retention_settings" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Data Retention Policies" id="admin.sidebar.dataRetentionSettingsPolicies" /> } /> <AdminSidebarSection definitionKey="compliance.message_export" key="compliance.message_export" name="compliance/export" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Compliance Export" id="admin.sidebar.complianceExport" /> } /> <AdminSidebarSection definitionKey="compliance.audits" key="compliance.audits" name="compliance/monitoring" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Compliance Monitoring" id="admin.sidebar.complianceMonitoring" /> } /> <AdminSidebarSection definitionKey="compliance.custom_terms_of_service" key="compliance.custom_terms_of_service" name="compliance/custom_terms_of_service" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Custom Terms of Service" id="admin.sidebar.customTermsOfService" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="experimental" icon={ <FlaskOutlineIcon color="currentColor" size={16} /> } key="experimental" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Experimental" id="admin.sidebar.experimental" /> } > <AdminSidebarSection definitionKey="experimental.experimental_features" key="experimental.experimental_features" name="experimental/features" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Features" id="admin.sidebar.experimentalFeatures" /> } /> <AdminSidebarSection definitionKey="experimental.feature_flags" key="experimental.feature_flags" name="experimental/feature_flags" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Feature Flags" id="admin.feature_flags.title" /> } /> <AdminSidebarSection definitionKey="experimental.bleve" key="experimental.bleve" name="experimental/blevesearch" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bleve" id="admin.sidebar.blevesearch" /> } /> </AdminSidebarCategory> </ul> </Highlight> </div> </Scrollbars> </div> `; exports[`components/AdminSidebar should match snapshot, with license (without any explicit feature) 1`] = ` <div className="admin-sidebar" > <Connect(SidebarHeader) /> <div className="filter-container" > <SearchIcon aria-hidden="true" className="search__icon" /> <QuickInput className="filter " clearable={true} id="adminSidebarFilter" onChange={[Function]} onClear={[Function]} placeholder="Find settings" type="text" value="" /> </div> <Scrollbars autoHeight={false} autoHeightMax={200} autoHeightMin={0} autoHide={true} autoHideDuration={500} autoHideTimeout={500} hideTracksWhenNotNeeded={false} renderThumbHorizontal={[Function]} renderThumbVertical={[Function]} renderTrackHorizontal={[Function]} renderTrackVertical={[Function]} renderView={[Function]} tagName="div" thumbMinSize={30} universal={false} > <div className="nav-pills__container" > <Highlight filter="" > <ul className="nav nav-pills nav-stacked" > <AdminSidebarCategory definitionKey="about" icon={ <InformationOutlineIcon color="currentColor" size={16} /> } key="about" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="About" id="admin.sidebar.about" /> } > <AdminSidebarSection definitionKey="about.license" key="about.license" name="about/license" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Edition and License" id="admin.sidebar.license" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="reporting" icon={ <ChartBarIcon color="currentColor" size={16} /> } key="reporting" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Reporting" id="admin.sidebar.reporting" /> } > <AdminSidebarSection definitionKey="reporting.workspace_optimization" key="reporting.workspace_optimization" name="reporting/workspace_optimization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Workspace Optimization" id="admin.sidebar.workspaceOptimization" /> } /> <AdminSidebarSection definitionKey="reporting.system_analytics" key="reporting.system_analytics" name="reporting/system_analytics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Statistics" id="admin.sidebar.siteStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.team_statistics" key="reporting.team_statistics" name="reporting/team_statistics" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Team Statistics" id="admin.sidebar.teamStatistics" /> } /> <AdminSidebarSection definitionKey="reporting.server_logs" key="reporting.server_logs" name="reporting/server_logs" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Server Logs" id="admin.sidebar.logs" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="user_management" icon={ <AccountMultipleOutlineIcon color="currentColor" size={16} /> } key="user_management" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="User Management" id="admin.sidebar.userManagement" /> } > <AdminSidebarSection definitionKey="user_management.system_users" key="user_management.system_users" name="user_management/users" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users" id="admin.sidebar.users" /> } /> <AdminSidebarSection definitionKey="user_management.groups_feature_discovery" key="user_management.groups_feature_discovery" name="user_management/groups" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="enterprise" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Groups" id="admin.sidebar.groups" /> } /> <AdminSidebarSection definitionKey="user_management.teams" key="user_management.teams" name="user_management/teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Teams" id="admin.sidebar.teams" /> } /> <AdminSidebarSection definitionKey="user_management.channel" key="user_management.channel" name="user_management/channels" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Channels" id="admin.sidebar.channels" /> } /> <AdminSidebarSection definitionKey="user_management.permissions" key="user_management.permissions" name="user_management/permissions/" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Permissions" id="admin.sidebar.permissions" /> } /> <AdminSidebarSection definitionKey="user_management.system_roles_feature_discovery" key="user_management.system_roles_feature_discovery" name="user_management/system_roles" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="enterprise" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="System Roles" id="admin.sidebar.systemRoles" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="environment" icon={ <ServerVariantIcon color="currentColor" size={16} /> } key="environment" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Environment" id="admin.sidebar.environment" /> } > <AdminSidebarSection definitionKey="environment.web_server" key="environment.web_server" name="environment/web_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Web Server" id="admin.sidebar.webServer" /> } /> <AdminSidebarSection definitionKey="environment.database" key="environment.database" name="environment/database" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Database" id="admin.sidebar.database" /> } /> <AdminSidebarSection definitionKey="environment.storage" key="environment.storage" name="environment/file_storage" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Storage" id="admin.sidebar.fileStorage" /> } /> <AdminSidebarSection definitionKey="environment.image_proxy" key="environment.image_proxy" name="environment/image_proxy" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Image Proxy" id="admin.sidebar.imageProxy" /> } /> <AdminSidebarSection definitionKey="environment.smtp" key="environment.smtp" name="environment/smtp" title={ <Memo(MemoizedFormattedMessage) defaultMessage="SMTP" id="admin.sidebar.smtp" /> } /> <AdminSidebarSection definitionKey="environment.push_notification_server" key="environment.push_notification_server" name="environment/push_notification_server" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Push Notification Server" id="admin.sidebar.pushNotificationServer" /> } /> <AdminSidebarSection definitionKey="environment.rate_limiting" key="environment.rate_limiting" name="environment/rate_limiting" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Rate Limiting" id="admin.sidebar.rateLimiting" /> } /> <AdminSidebarSection definitionKey="environment.logging" key="environment.logging" name="environment/logging" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Logging" id="admin.sidebar.logging" /> } /> <AdminSidebarSection definitionKey="environment.session_lengths" key="environment.session_lengths" name="environment/session_lengths" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Session Lengths" id="admin.sidebar.sessionLengths" /> } /> <AdminSidebarSection definitionKey="environment.metrics" key="environment.metrics" name="environment/performance_monitoring" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Performance Monitoring" id="admin.sidebar.metrics" /> } /> <AdminSidebarSection definitionKey="environment.developer" key="environment.developer" name="environment/developer" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Developer" id="admin.sidebar.developer" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="site" icon={ <CogOutlineIcon color="currentColor" size={16} /> } key="site" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Site Configuration" id="admin.sidebar.site" /> } > <AdminSidebarSection definitionKey="site.customization" key="site.customization" name="site_config/customization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Customization" id="admin.sidebar.customization" /> } /> <AdminSidebarSection definitionKey="site.localization" key="site.localization" name="site_config/localization" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Localization" id="admin.sidebar.localization" /> } /> <AdminSidebarSection definitionKey="site.users_and_teams" key="site.users_and_teams" name="site_config/users_and_teams" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Users and Teams" id="admin.sidebar.usersAndTeams" /> } /> <AdminSidebarSection definitionKey="site.notifications" key="site.notifications" name="environment/notifications" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notifications" id="admin.sidebar.notifications" /> } /> <AdminSidebarSection definitionKey="site.announcement_banner_feature_discovery" key="site.announcement_banner_feature_discovery" name="site_config/announcement_banner" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="professional" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Announcement Banner" id="admin.sidebar.announcement" /> } /> <AdminSidebarSection definitionKey="site.emoji" key="site.emoji" name="site_config/emoji" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Emoji" id="admin.sidebar.emoji" /> } /> <AdminSidebarSection definitionKey="site.posts" key="site.posts" name="site_config/posts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Posts" id="admin.sidebar.posts" /> } /> <AdminSidebarSection definitionKey="site.file_sharing_downloads" key="site.file_sharing_downloads" name="site_config/file_sharing_downloads" title={ <Memo(MemoizedFormattedMessage) defaultMessage="File Sharing and Downloads" id="admin.sidebar.fileSharingDownloads" /> } /> <AdminSidebarSection definitionKey="site.public_links" key="site.public_links" name="site_config/public_links" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Public Links" id="admin.sidebar.publicLinks" /> } /> <AdminSidebarSection definitionKey="site.notices" key="site.notices" name="site_config/notices" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Notices" id="admin.sidebar.notices" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="authentication" icon={ <ShieldOutlineIcon color="currentColor" size={16} /> } key="authentication" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Authentication" id="admin.sidebar.authentication" /> } > <AdminSidebarSection definitionKey="authentication.signup" key="authentication.signup" name="authentication/signup" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Signup" id="admin.sidebar.signup" /> } /> <AdminSidebarSection definitionKey="authentication.email" key="authentication.email" name="authentication/email" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Email" id="admin.sidebar.email" /> } /> <AdminSidebarSection definitionKey="authentication.password" key="authentication.password" name="authentication/password" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Password" id="admin.sidebar.password" /> } /> <AdminSidebarSection definitionKey="authentication.mfa" key="authentication.mfa" name="authentication/mfa" title={ <Memo(MemoizedFormattedMessage) defaultMessage="MFA" id="admin.sidebar.mfa" /> } /> <AdminSidebarSection definitionKey="authentication.ldap_feature_discovery" key="authentication.ldap_feature_discovery" name="authentication/ldap" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="professional" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="AD/LDAP" id="admin.sidebar.ldap" /> } /> <AdminSidebarSection definitionKey="authentication.saml_feature_discovery" key="authentication.saml_feature_discovery" name="authentication/saml" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="professional" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="SAML 2.0" id="admin.sidebar.saml" /> } /> <AdminSidebarSection definitionKey="authentication.oauth" key="authentication.oauth" name="authentication/oauth" title={ <Memo(MemoizedFormattedMessage) defaultMessage="OAuth 2.0" id="admin.sidebar.oauth" /> } /> <AdminSidebarSection definitionKey="authentication.openid_feature_discovery" key="authentication.openid_feature_discovery" name="authentication/openid" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="professional" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="OpenID Connect" id="admin.sidebar.openid" /> } /> <AdminSidebarSection definitionKey="authentication.guest_access_feature_discovery" key="authentication.guest_access_feature_discovery" name="authentication/guest_access" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="professional" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Guest Access" id="admin.sidebar.guest_access" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="plugins" icon={ <PowerPlugOutlineIcon color="currentColor" size={16} /> } key="plugins" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugins" id="admin.sidebar.plugins" /> } > <AdminSidebarSection definitionKey="plugins.plugin_management" key="plugins.plugin_management" name="plugins/plugin_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Plugin Management" id="admin.plugins.pluginManagement" /> } /> <AdminSidebarSection key="custompluginplugin_0" name="plugins/plugin_plugin_0" title="Plugin 0" /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="integrations" icon={ <SitemapIcon color="currentColor" size={16} /> } key="integrations" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integrations" id="admin.sidebar.integrations" /> } > <AdminSidebarSection definitionKey="integrations.integration_management" key="integrations.integration_management" name="integrations/integration_management" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Integration Management" id="admin.integrations.integrationManagement" /> } /> <AdminSidebarSection definitionKey="integrations.bot_accounts" key="integrations.bot_accounts" name="integrations/bot_accounts" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bot Accounts" id="admin.integrations.botAccounts" /> } /> <AdminSidebarSection definitionKey="integrations.gif" key="integrations.gif" name="integrations/gif" title={ <Memo(MemoizedFormattedMessage) defaultMessage="GIF (Beta)" id="admin.sidebar.gif" /> } /> <AdminSidebarSection definitionKey="integrations.cors" key="integrations.cors" name="integrations/cors" title={ <Memo(MemoizedFormattedMessage) defaultMessage="CORS" id="admin.sidebar.cors" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="compliance" icon={ <FormatListBulletedIcon color="currentColor" size={16} /> } key="compliance" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Compliance" id="admin.sidebar.compliance" /> } > <AdminSidebarSection definitionKey="compliance.data_retention_feature_discovery" key="compliance.data_retention_feature_discovery" name="compliance/data_retention" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="enterprise" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Data Retention Policy" id="admin.sidebar.dataRetentionPolicy" /> } /> <AdminSidebarSection definitionKey="compliance.compliance_export_feature_discovery" key="compliance.compliance_export_feature_discovery" name="compliance/export" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="enterprise" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Compliance Export" id="admin.sidebar.complianceExport" /> } /> <AdminSidebarSection definitionKey="compliance.custom_terms_of_service_feature_discovery" key="compliance.custom_terms_of_service_feature_discovery" name="compliance/custom_terms_of_service" restrictedIndicator={ <RestrictedIndicator blocked={true} minimumPlanRequiredForFeature="enterprise" tooltipMessageBlocked={ Object { "defaultMessage": "This is {article} {minimumPlanRequiredForFeature} feature, available with an upgrade or free {trialLength}-day trial", "id": "admin.sidebar.restricted_indicator.tooltip.message.blocked", } } useModal={false} /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Custom Terms of Service" id="admin.sidebar.customTermsOfService" /> } /> </AdminSidebarCategory> <AdminSidebarCategory definitionKey="experimental" icon={ <FlaskOutlineIcon color="currentColor" size={16} /> } key="experimental" parentLink="/admin_console" sectionClass="" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Experimental" id="admin.sidebar.experimental" /> } > <AdminSidebarSection definitionKey="experimental.experimental_features" key="experimental.experimental_features" name="experimental/features" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Features" id="admin.sidebar.experimentalFeatures" /> } /> <AdminSidebarSection definitionKey="experimental.feature_flags" key="experimental.feature_flags" name="experimental/feature_flags" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Feature Flags" id="admin.feature_flags.title" /> } /> <AdminSidebarSection definitionKey="experimental.bleve" key="experimental.bleve" name="experimental/blevesearch" title={ <Memo(MemoizedFormattedMessage) defaultMessage="Bleve" id="admin.sidebar.blevesearch" /> } /> </AdminSidebarCategory> </ul> </Highlight> </div> </Scrollbars> </div> `;
947
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/admin_user_card/admin_user_card.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import {renderWithContext, screen} from 'tests/react_testing_utils'; import {TestHelper} from 'utils/test_helper'; import AdminUserCard from './admin_user_card'; describe('components/admin_console/admin_user_card/admin_user_card', () => { const user = TestHelper.getUserMock({ first_name: 'Jim', last_name: 'Halpert', nickname: 'Big Tuna', id: '1234', }); const defaultProps = { user, } as any; test('should match default snapshot', () => { const props = defaultProps; const {container} = renderWithContext(<AdminUserCard {...props}/>); screen.getByText(props.user.first_name, {exact: false}); screen.getByText(props.user.last_name, {exact: false}); screen.getByText(props.user.nickname, {exact: false}); expect(container).toMatchSnapshot(); }); test('should match snapshot if no nickname is defined', () => { const props = { ...defaultProps, user: { ...defaultProps.user, nickname: null, }, }; const {container} = renderWithContext(<AdminUserCard {...props}/>); screen.getByText(props.user.first_name, {exact: false}); screen.getByText(props.user.last_name, {exact: false}); expect(screen.queryByText(defaultProps.user.nickname)).not.toBeInTheDocument(); expect(container).toMatchSnapshot(); }); test('should match snapshot if no first/last name is defined', () => { const props = { ...defaultProps, user: { ...defaultProps.user, first_name: null, last_name: null, }, }; const {container} = renderWithContext(<AdminUserCard {...props}/>); expect(screen.queryByText(defaultProps.user.first_name)).not.toBeInTheDocument(); expect(screen.queryByText(defaultProps.user.last_name)).not.toBeInTheDocument(); screen.getByText(props.user.nickname, {exact: false}); expect(container).toMatchSnapshot(); }); test('should match snapshot if no first/last name or nickname is defined', () => { const props = { ...defaultProps, user: { ...defaultProps.user, first_name: null, last_name: null, nickname: null, }, }; const {container} = renderWithContext(<AdminUserCard {...props}/>); expect(screen.queryByText(defaultProps.user.first_name)).not.toBeInTheDocument(); expect(screen.queryByText(defaultProps.user.last_name)).not.toBeInTheDocument(); expect(screen.queryByText(defaultProps.user.nickname)).not.toBeInTheDocument(); screen.getByText(props.user.id, {exact: false}); expect(container).toMatchSnapshot(); }); });
949
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/admin_user_card
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/admin_user_card/__snapshots__/admin_user_card.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/admin_user_card/admin_user_card should match default snapshot 1`] = ` <div> <div class="AdminUserCard" > <div class="AdminUserCard__header" > <span class="status-wrapper admin-user-card" > <button class="RoundButton-dvlhqG gnYSKj style--none" > <span class="profile-icon " > <img alt="user profile image" class="Avatar Avatar-xxl" loading="lazy" src="/api/v4/users/1234/image" tabindex="-1" /> </span> </button> </span> <div class="AdminUserCard__user-info" > <span> Jim Halpert </span> <span> • </span> <span class="AdminUserCard__user-nickname" > Big Tuna </span> </div> <div class="AdminUserCard__user-id" > User ID: 1234 </div> </div> <div class="AdminUserCard__body" /> <div class="AdminUserCard__footer" /> </div> </div> `; exports[`components/admin_console/admin_user_card/admin_user_card should match snapshot if no first/last name is defined 1`] = ` <div> <div class="AdminUserCard" > <div class="AdminUserCard__header" > <span class="status-wrapper admin-user-card" > <button class="RoundButton-dvlhqG gnYSKj style--none" > <span class="profile-icon " > <img alt="user profile image" class="Avatar Avatar-xxl" loading="lazy" src="/api/v4/users/1234/image" tabindex="-1" /> </span> </button> </span> <div class="AdminUserCard__user-info" > <span> </span> <span class="AdminUserCard__user-nickname" > Big Tuna </span> </div> <div class="AdminUserCard__user-id" > User ID: 1234 </div> </div> <div class="AdminUserCard__body" /> <div class="AdminUserCard__footer" /> </div> </div> `; exports[`components/admin_console/admin_user_card/admin_user_card should match snapshot if no first/last name or nickname is defined 1`] = ` <div> <div class="AdminUserCard" > <div class="AdminUserCard__header" > <span class="status-wrapper admin-user-card" > <button class="RoundButton-dvlhqG gnYSKj style--none" > <span class="profile-icon " > <img alt="user profile image" class="Avatar Avatar-xxl" loading="lazy" src="/api/v4/users/1234/image" tabindex="-1" /> </span> </button> </span> <div class="AdminUserCard__user-info" > <span> </span> <span class="AdminUserCard__user-nickname" /> </div> <div class="AdminUserCard__user-id" > User ID: 1234 </div> </div> <div class="AdminUserCard__body" /> <div class="AdminUserCard__footer" /> </div> </div> `; exports[`components/admin_console/admin_user_card/admin_user_card should match snapshot if no nickname is defined 1`] = ` <div> <div class="AdminUserCard" > <div class="AdminUserCard__header" > <span class="status-wrapper admin-user-card" > <button class="RoundButton-dvlhqG gnYSKj style--none" > <span class="profile-icon " > <img alt="user profile image" class="Avatar Avatar-xxl" loading="lazy" src="/api/v4/users/1234/image" tabindex="-1" /> </span> </button> </span> <div class="AdminUserCard__user-info" > <span> Jim Halpert </span> <span class="AdminUserCard__user-nickname" /> </div> <div class="AdminUserCard__user-id" > User ID: 1234 </div> </div> <div class="AdminUserCard__body" /> <div class="AdminUserCard__footer" /> </div> </div> `;
953
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/billing_history.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import {renderWithContext, screen} from 'tests/react_testing_utils'; import {CloudLinks, HostedCustomerLinks} from 'utils/constants'; import {TestHelper} from 'utils/test_helper'; import BillingHistory, {NoBillingHistorySection} from './billing_history'; const NO_INVOICES_LEGEND = 'All of your invoices will be shown here'; const invoiceA = TestHelper.getInvoiceMock({ id: 'in_1KNb3DI67GP2qpb4ueaJYBt8', number: '87030375-0015', create_at: 1643540071000, total: 1000, tax: 0, status: 'open', description: '', period_start: 1642330466000, period_end: 1643540066000, subscription_id: 'sub_1KIWNTI67GP2qpb49XXiEscG', line_items: [ { price_id: 'price_1JMAbZI67GP2qpb4ADjRJwYa', total: 1000, quantity: 1, price_per_unit: 1000, description: '1 × Cloud Professional (at $10.00 / month)', type: 'onpremise', metadata: {}, }, ], }); const invoiceB = TestHelper.getInvoiceMock({ id: 'in_1KIWNTI67GP2qpb4KjGj1KAy', number: '87030375-0013', create_at: 1642330467000, total: 0, tax: 0, status: 'paid', description: '', period_start: 1642330466000, period_end: 1642330466000, subscription_id: 'sub_1KIWNTI67GP2qpb49XXiEscG', line_items: [ { price_id: 'price_1JMAbZI67GP2qpb4ADjRJwYa', total: 0, quantity: 1, price_per_unit: 1000, description: 'Trial period for Cloud Professional', type: 'onpremise', metadata: {}, }, ], }); describe('components/admin_console/billing/billing_history', () => { // required state to mount using the provider const state = { entities: { general: { license: { IsLicensed: 'true', Cloud: 'true', }, config: { DiagnosticsEnabled: 'false', }, }, users: { currentUserId: 'current_user_id', profiles: { current_user_id: {roles: 'system_role'}, }, }, cloud: { errors: {}, invoices: { in_1KNb3DI67GP2qpb4ueaJYBt8: invoiceA, in_1KIWNTI67GP2qpb4KjGj1KAy: invoiceB, }, }, }, views: {}, }; test('should match the default state of the component with given props', () => { renderWithContext( <BillingHistory/>, state, ); expect(screen.queryByText('Billing History')).toBeInTheDocument(); expect(screen.queryByText('Transactions')).toBeInTheDocument(); expect(screen.queryByText('All of your invoices will be shown here')).toBeInTheDocument(); expect(screen.getByTestId(invoiceA.number)).toHaveTextContent((invoiceA.total / 100.0).toString()); expect(screen.getByTestId(invoiceB.number)).toHaveTextContent((invoiceB.total / 100.0).toString()); expect(screen.getByTestId(invoiceA.id)).toHaveTextContent('Pending'); expect(screen.getByTestId(invoiceB.id)).toHaveTextContent('Paid'); }); test('Billing history section shows template when no invoices have been emitted yet', () => { const noBillingHistoryState = { ...state, entities: {...state.entities, cloud: {invoices: {}, errors: {}}}, }; renderWithContext( <BillingHistory/>, noBillingHistoryState, ); expect(screen.queryByText('Date')).not.toBeInTheDocument(); expect(screen.queryByText('Description')).not.toBeInTheDocument(); expect(screen.queryByText('Total')).not.toBeInTheDocument(); expect(screen.queryByText('Status')).not.toBeInTheDocument(); expect(screen.queryByTestId(invoiceA.number)).not.toBeInTheDocument(); expect(screen.queryByTestId(invoiceB.number)).not.toBeInTheDocument(); expect(screen.queryByTestId(invoiceA.id)).not.toBeInTheDocument(); expect(screen.queryByTestId(invoiceB.id)).not.toBeInTheDocument(); expect(screen.getByRole('link')).toHaveAttribute('href', CloudLinks.BILLING_DOCS + '?utm_source=mattermost&utm_medium=in-product-cloud&utm_content=billing_history&uid=current_user_id&sid='); expect(screen.getByRole('link')).toHaveTextContent('See how billing works'); expect(screen.getByTestId('no-invoices')).toHaveTextContent(NO_INVOICES_LEGEND); }); test('Billing history section shows two invoices to download', () => { renderWithContext( <BillingHistory/>, state, ); expect(screen.queryByText('Date')).toBeInTheDocument(); expect(screen.queryByText('Description')).toBeInTheDocument(); expect(screen.queryByText('Total')).toBeInTheDocument(); expect(screen.queryByText('Status')).toBeInTheDocument(); expect(screen.getAllByTestId('billingHistoryTableRow')).toHaveLength(2); }); test('Billing history section download button has the target property set as _self so it works well in desktop app', () => { renderWithContext( <BillingHistory/>, state, ); expect(screen.getByTestId(`billingHistoryLink-${invoiceA.id}`)).toHaveAttribute('target', '_self'); expect(screen.getByTestId(`billingHistoryLink-${invoiceB.id}`)).toHaveAttribute('target', '_self'); expect(screen.getByTestId(`billingHistoryLink-${invoiceA.id}`)).toHaveAttribute('href', '/api/v4/cloud/subscription/invoices/in_1KNb3DI67GP2qpb4ueaJYBt8/pdf'); expect(screen.getByTestId(`billingHistoryLink-${invoiceB.id}`)).toHaveAttribute('href', '/api/v4/cloud/subscription/invoices/in_1KIWNTI67GP2qpb4KjGj1KAy/pdf'); }); }); describe('BillingHistory -- self-hosted', () => { // required state to mount using the provider const state = { entities: { general: { license: { IsLicensed: 'true', Cloud: 'false', }, config: { DiagnosticsEnabled: 'false', }, }, users: { currentUserId: 'current_user_id', profiles: { current_user_id: {roles: 'system_role'}, }, }, hostedCustomer: { errors: {}, invoices: { invoices: { in_1KNb3DI67GP2qpb4ueaJYBt8: invoiceA, in_1KIWNTI67GP2qpb4KjGj1KAy: invoiceB, }, invoicesLoaded: true, }, }, }, views: {}, }; test('Billing history section shows template when no invoices have been emitted yet', () => { const noBillingHistoryState = { ...state, entities: {...state.entities, hostedCustomer: {invoices: {invoices: {}, invoicesLoaded: true}, errors: {}}}, }; renderWithContext( <BillingHistory/>, noBillingHistoryState, ); expect(screen.queryByText('Date')).not.toBeInTheDocument(); expect(screen.queryByText('Description')).not.toBeInTheDocument(); expect(screen.queryByText('Total')).not.toBeInTheDocument(); expect(screen.queryByText('Status')).not.toBeInTheDocument(); expect(screen.queryByTestId(invoiceA.number)).not.toBeInTheDocument(); expect(screen.queryByTestId(invoiceB.number)).not.toBeInTheDocument(); expect(screen.queryByTestId(invoiceA.id)).not.toBeInTheDocument(); expect(screen.queryByTestId(invoiceB.id)).not.toBeInTheDocument(); expect(screen.getByRole('link')).toHaveAttribute('href', HostedCustomerLinks.SELF_HOSTED_BILLING + '?utm_source=mattermost&utm_medium=in-product&utm_content=billing_history&uid=current_user_id&sid='); expect(screen.getByRole('link')).toHaveTextContent('See how billing works'); expect(screen.getByTestId('no-invoices')).toHaveTextContent(NO_INVOICES_LEGEND); }); test('Billing history section shows two invoices to download', () => { renderWithContext( <BillingHistory/>, state, ); expect(screen.queryByText('Date')).toBeInTheDocument(); expect(screen.queryByText('Description')).toBeInTheDocument(); expect(screen.queryByText('Total')).toBeInTheDocument(); expect(screen.queryByText('Status')).toBeInTheDocument(); expect(screen.getAllByTestId('billingHistoryTableRow')).toHaveLength(2); }); }); describe('NoBillingHistorySection', () => { const state = {entities: {users: {}, general: {config: {}, license: {}}}} as any; test('goes to cloud docs on cloud', () => { renderWithContext( <NoBillingHistorySection selfHosted={false}/>, state, ); expect((screen.getByRole('link') as HTMLAnchorElement).href).toContain(CloudLinks.BILLING_DOCS); }); test('goes to self-hosted docs on self-hosted', () => { renderWithContext( <NoBillingHistorySection selfHosted={true}/>, state, ); expect((screen.getByRole('link') as HTMLAnchorElement).href).toContain(HostedCustomerLinks.SELF_HOSTED_BILLING); }); });
963
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/invoice_user_count.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import {InvoiceLineItemType} from '@mattermost/types/cloud'; import type {Invoice} from '@mattermost/types/cloud'; import {mountWithIntl} from 'tests/helpers/intl-test-helper'; import InvoiceUserCount from './invoice_user_count'; function makeInvoice(...lines: Array<[number, typeof InvoiceLineItemType[keyof typeof InvoiceLineItemType]]>): Invoice { return { id: '', current_product_name: '', number: '', create_at: 0, total: 0, tax: 0, status: '', description: '', period_start: 0, period_end: 0, subscription_id: '', line_items: lines.map(([quantity, type], index) => { const lineItem = { price_id: `price_${index}`, total: 0, quantity, price_per_unit: 0, description: '', type, metadata: {} as Record<string, string>, }; if (type === InvoiceLineItemType.Full || type === InvoiceLineItemType.Partial) { lineItem.metadata.type = type; lineItem.metadata.quantity = 'quantity'; lineItem.metadata.unit_amount_decimal = '123'; } return lineItem; }), }; } describe('InvoiceUserCount', () => { const tests = [ { name: 'Supports cloud invoices with metered and non-metered line items', invoice: makeInvoice( [1, InvoiceLineItemType.Metered], [1, InvoiceLineItemType.Full], [1, InvoiceLineItemType.Partial], ), expected: '1 metered seats, 1 seats at full rate, 1 seats with partial charges', }, { name: 'Supports cloud invoices with only metered line items', invoice: makeInvoice( [12.34, InvoiceLineItemType.Metered], ), expected: '12.34 seats', }, { name: 'Shows minimum decimal necessary', invoice: makeInvoice( [12.499, InvoiceLineItemType.Metered], ), expected: '12.5 seats', }, { name: 'hides insignificant decimals', invoice: makeInvoice( [12.002, InvoiceLineItemType.Metered], ), expected: '12 seats', }, { name: 'Supports cloud invoices with only non-metered line items', invoice: makeInvoice( [1, InvoiceLineItemType.Full], [249, InvoiceLineItemType.Partial], ), expected: '1 seats at full rate, 249 seats with partial charges', }, { name: 'Shows default of 0 full users, 0 partial users when there are no users', invoice: makeInvoice( [0, InvoiceLineItemType.Metered], [0, InvoiceLineItemType.Full], [0, InvoiceLineItemType.Partial], ), expected: '0 seats at full rate, 0 seats with partial charges', }, { name: 'Shows default of 0 full users, 0 partial users when there are no line items in invoice', invoice: makeInvoice(), expected: '0 seats at full rate, 0 seats with partial charges', }, { name: 'Shows 3 full userswhen there are on prem users', invoice: makeInvoice( [3, InvoiceLineItemType.OnPremise], ), expected: '3 seats', }, ]; tests.forEach(({name, invoice, expected}) => { it(name, () => { const wrapper = mountWithIntl(<InvoiceUserCount invoice={invoice}/>); expect(wrapper.text()).toBe(expected); }); }); });
976
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/billing_subscriptions/cloud_trial_banner.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import {Provider} from 'react-redux'; import {getPreferenceKey} from 'mattermost-redux/utils/preference_utils'; import mockStore from 'tests/test_store'; import {CloudBanners, Preferences} from 'utils/constants'; import CloudTrialBanner from './cloud_trial_banner'; jest.mock('components/common/hooks/useOpenSalesLink', () => ({ __esModule: true, default: () => () => true, })); const mockDispatch = jest.fn(); let mockState: any; jest.mock('react-redux', () => ({ ...jest.requireActual('react-redux') as typeof import('react-redux'), useSelector: (selector: (state: typeof mockState) => unknown) => selector(mockState), useDispatch: () => mockDispatch, })); describe('components/admin_console/billing_subscription/CloudTrialBanner', () => { const state = { entities: { users: { currentUserId: 'test_id', }, admin: { prevTrialLicense: { IsLicensed: 'false', }, }, general: { license: { IsLicensed: 'false', }, }, preferences: { myPreferences: {}, }, }, }; const store = mockStore(state); test('should match snapshot when no trial end date is passed', () => { const wrapper = shallow( <Provider store={store}> <CloudTrialBanner trialEndDate={0}/> </Provider>, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot when is cloud and is free trial (the trial end is passed)', () => { const wrapper = shallow( <Provider store={store}> <CloudTrialBanner trialEndDate={12345}/> </Provider>, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot when there is an stored preference value', () => { const myPref = { myPreferences: { [getPreferenceKey(Preferences.CLOUD_TRIAL_BANNER, CloudBanners.UPGRADE_FROM_TRIAL)]: { category: Preferences.CLOUD_TRIAL_BANNER, name: CloudBanners.UPGRADE_FROM_TRIAL, value: new Date().getTime().toString(), }, }, }; const stateWithPref = {...state, entities: {...state.entities, preferences: myPref}}; const store = mockStore(stateWithPref); const wrapper = shallow( <Provider store={store}> <CloudTrialBanner trialEndDate={12345}/> </Provider>, ); expect(wrapper).toMatchSnapshot(); }); });
983
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/billing_subscriptions/limit_reached_banner.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import type {GlobalState} from '@mattermost/types/store'; import type {UserProfile, UsersState} from '@mattermost/types/users'; import {Preferences} from 'mattermost-redux/constants'; import {getPreferenceKey} from 'mattermost-redux/utils/preference_utils'; import * as useGetUsageDeltas from 'components/common/hooks/useGetUsageDeltas'; import * as useOpenCloudPurchaseModal from 'components/common/hooks/useOpenCloudPurchaseModal'; import * as useOpenPricingModal from 'components/common/hooks/useOpenPricingModal'; import * as useOpenSalesLink from 'components/common/hooks/useOpenSalesLink'; import * as useSaveBool from 'components/common/hooks/useSavePreferences'; import {fireEvent, renderWithContext, screen} from 'tests/react_testing_utils'; import {CloudProducts} from 'utils/constants'; import LimitReachedBanner from './limit_reached_banner'; const upgradeCloudKey = getPreferenceKey(Preferences.CATEGORY_UPGRADE_CLOUD, Preferences.SYSTEM_CONSOLE_LIMIT_REACHED); const state: GlobalState = { entities: { users: { currentUserId: 'userid', profiles: { userid: {} as UserProfile, }, } as unknown as UsersState, preferences: { myPreferences: { [upgradeCloudKey]: {value: 'false'}, }, }, cloud: { limits: { }, products: { }, }, general: { license: { }, config: { }, }, }, } as GlobalState; const base = { id: '', name: '', description: '', price_per_seat: 0, add_ons: [], product_family: '', billing_scheme: '', recurring_interval: '', cross_sells_to: '', }; const free = {...base, sku: CloudProducts.STARTER}; const enterprise = {...base, sku: CloudProducts.ENTERPRISE}; const noLimitReached = { files: { totalStorage: -1, totalStorageLoaded: true, }, messages: { history: -1, historyLoaded: true, }, boards: { cards: -1, cardsLoaded: true, }, teams: { active: -1, cloudArchived: -1, teamsLoaded: true, }, integrations: { enabled: -1, enabledLoaded: true, }, }; const someLimitReached = { ...noLimitReached, integrations: { ...noLimitReached.integrations, enabled: 1, }, }; const titleFree = /Upgrade to one of our paid plans to avoid/; const titleProfessional = /Upgrade to Enterprise to avoid Professional plan/; function makeSpies() { const mockUseOpenSalesLink = jest.spyOn(useOpenSalesLink, 'default'); const mockUseGetUsageDeltas = jest.spyOn(useGetUsageDeltas, 'default'); const mockUseOpenCloudPurchaseModal = jest.spyOn(useOpenCloudPurchaseModal, 'default'); const mockUseOpenPricingModal = jest.spyOn(useOpenPricingModal, 'default'); const mockUseSaveBool = jest.spyOn(useSaveBool, 'useSaveBool'); return { useOpenSalesLink: mockUseOpenSalesLink, useGetUsageDeltas: mockUseGetUsageDeltas, useOpenCloudPurchaseModal: mockUseOpenCloudPurchaseModal, useOpenPricingModal: mockUseOpenPricingModal, useSaveBool: mockUseSaveBool, }; } describe('limits_reached_banner', () => { test('does not render when product is enterprise', () => { const spies = makeSpies(); spies.useGetUsageDeltas.mockReturnValue(someLimitReached); renderWithContext(<LimitReachedBanner product={enterprise}/>, state); expect(screen.queryByText(titleFree)).not.toBeInTheDocument(); expect(screen.queryByText(titleProfessional)).not.toBeInTheDocument(); }); test('does not render when banner was dismissed', () => { const myState = { ...state, entities: { ...state.entities, preferences: { ...state.entities.preferences, myPreferences: { ...state.entities.preferences.myPreferences, [upgradeCloudKey]: {value: 'true'}, }, }, }, }; const spies = makeSpies(); spies.useGetUsageDeltas.mockReturnValue(someLimitReached); renderWithContext(<LimitReachedBanner product={enterprise}/>, myState); expect(screen.queryByText(titleFree)).not.toBeInTheDocument(); expect(screen.queryByText(titleProfessional)).not.toBeInTheDocument(); }); test('does not render when no limit reached', () => { const spies = makeSpies(); spies.useGetUsageDeltas.mockReturnValue(noLimitReached); renderWithContext(<LimitReachedBanner product={free}/>, state); expect(screen.queryByText(titleFree)).not.toBeInTheDocument(); expect(screen.queryByText(titleProfessional)).not.toBeInTheDocument(); }); test('renders free banner', () => { const spies = makeSpies(); const mockOpenPricingModal = jest.fn(); spies.useOpenPricingModal.mockReturnValue(mockOpenPricingModal); spies.useGetUsageDeltas.mockReturnValue(someLimitReached); renderWithContext(<LimitReachedBanner product={free}/>, state); screen.getByText(titleFree); expect(screen.queryByText(titleProfessional)).not.toBeInTheDocument(); fireEvent.click(screen.getByText('View plans')); expect(mockOpenPricingModal).toHaveBeenCalled(); }); test('clicking Contact Sales opens sales link', () => { const spies = makeSpies(); const mockOpenSalesLink = jest.fn(); spies.useOpenSalesLink.mockReturnValue([mockOpenSalesLink, '']); spies.useGetUsageDeltas.mockReturnValue(someLimitReached); renderWithContext(<LimitReachedBanner product={free}/>, state); screen.getByText(titleFree); expect(screen.queryByText(titleProfessional)).not.toBeInTheDocument(); fireEvent.click(screen.getByText('Contact sales')); expect(mockOpenSalesLink).toHaveBeenCalled(); }); });
986
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/billing_subscriptions/limits.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import * as redux from 'react-redux'; import type {Subscription, Product} from '@mattermost/types/cloud'; import type {GlobalState} from '@mattermost/types/store'; import type {UserProfile, UsersState} from '@mattermost/types/users'; import type {DeepPartial} from '@mattermost/types/utilities'; import * as cloudActions from 'actions/cloud'; import {renderWithContext, screen} from 'tests/react_testing_utils'; import {Constants, CloudProducts} from 'utils/constants'; import {FileSizes} from 'utils/file_utils'; import Limits from './limits'; const freeLimits = { messages: { history: 10000, }, files: { total_storage: FileSizes.Gigabyte, }, teams: { active: 1, }, boards: { cards: 500, views: 5, }, }; interface SetupOptions { isEnterprise?: boolean; } function setupState(setupOptions: SetupOptions): DeepPartial<GlobalState> { const state = { entities: { cloud: { limits: { limitsLoaded: !setupOptions.isEnterprise, limits: setupOptions.isEnterprise ? {} : freeLimits, }, subscription: { product_id: setupOptions.isEnterprise ? 'prod_enterprise' : 'prod_free', } as Subscription, products: { prod_free: { id: 'prod_free', name: 'Cloud Free', sku: CloudProducts.STARTER, } as Product, prod_enterprise: { id: 'prod_enterprise', name: 'Cloud Enterprise', sku: CloudProducts.ENTERPRISE, } as Product, } as Record<string, Product>, }, usage: { files: { totalStorage: 0, totalStorageLoaded: true, }, messages: { history: 0, historyLoaded: true, }, teams: { active: 0, cloudArchived: 0, teamsLoaded: true, }, }, admin: { analytics: { [Constants.StatTypes.TOTAL_POSTS]: 1234, } as GlobalState['entities']['admin']['analytics'], }, users: { currentUserId: 'userid', profiles: { userid: {} as UserProfile, }, } as unknown as UsersState, general: { license: {}, config: {}, }, }, }; if (setupOptions.isEnterprise) { state.entities.cloud.subscription!.is_free_trial = 'true'; } return state; } describe('Limits', () => { const defaultOptions = {}; test('message limit rendered in K', () => { const state = setupState(defaultOptions); renderWithContext(<Limits/>, state); screen.getByText('Message History'); screen.getByText(/of 10K/); }); test('storage limit rendered in GB', () => { const state = setupState(defaultOptions); renderWithContext(<Limits/>, state); screen.getByText('File Storage'); screen.getByText(/of 1GB/); }); test('renders nothing if on enterprise', () => { const mockGetLimits = jest.fn(); jest.spyOn(cloudActions, 'getCloudLimits').mockImplementation(mockGetLimits); jest.spyOn(redux, 'useDispatch').mockImplementation(jest.fn(() => jest.fn())); const state = setupState({isEnterprise: true}); renderWithContext(<Limits/>, state); expect(screen.queryByTestId('limits-panel-title')).not.toBeInTheDocument(); }); test('renders elements if not on enterprise', () => { const mockGetLimits = jest.fn(); jest.spyOn(cloudActions, 'getCloudLimits').mockImplementation(mockGetLimits); jest.spyOn(redux, 'useDispatch').mockImplementation(jest.fn(() => jest.fn())); const state = setupState(defaultOptions); renderWithContext(<Limits/>, state); screen.getByTestId('limits-panel-title'); }); });
990
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/billing_subscriptions/to_paid_plan_nudge_banner.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import {renderWithContext, screen} from 'tests/react_testing_utils'; import {CloudProducts} from 'utils/constants'; import {ToPaidNudgeBanner, ToPaidPlanBannerDismissable} from './to_paid_plan_nudge_banner'; const initialState = { views: { announcementBar: { announcementBarState: { announcementBarCount: 1, }, }, }, entities: { general: { config: { CWSURL: '', FeatureFlagDeprecateCloudFree: 'true', }, license: { IsLicensed: 'true', Cloud: 'true', }, }, users: { currentUserId: 'current_user_id', profiles: { current_user_id: {roles: 'system_user'}, }, }, preferences: { myPreferences: {}, }, cloud: {}, }, }; describe('ToPaidPlanBannerDismissable', () => { test('should only show for admins on cloud free', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_admin'}, }; state.entities.cloud = { subscription: { product_id: 'prod_starter', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_starter: { id: 'prod_starter', sku: CloudProducts.STARTER, }, }, }; renderWithContext(<ToPaidPlanBannerDismissable/>, state, {useMockedStore: true}); screen.getByTestId('cloud-free-deprecation-announcement-bar'); }); test('should NOT show for NON admins', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_user'}, }; state.entities.cloud = { subscription: { product_id: 'prod_starter', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_starter: { id: 'prod_starter', sku: CloudProducts.STARTER, }, }, }; renderWithContext(<ToPaidPlanBannerDismissable/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-free-deprecation-announcement-bar')).toThrow(); }); test('should NOT show for admins on cloud pro', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_admin'}, }; state.entities.cloud = { subscription: { product_id: 'prod_pro', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_pro: { id: 'prod_pro', sku: CloudProducts.PROFESSIONAL, }, }, }; renderWithContext(<ToPaidPlanBannerDismissable/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-free-deprecation-announcement-bar')).toThrow(); }); test('should NOT show for admins on cloud enterprise', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_admin'}, }; state.entities.cloud = { subscription: { product_id: 'prod_enterprise', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_enterprise: { id: 'prod_enterprise', sku: CloudProducts.ENTERPRISE, }, }, }; renderWithContext(<ToPaidPlanBannerDismissable/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-free-deprecation-announcement-bar')).toThrow(); }); test('should NOT show for admins when banner was dismissed in preferences', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_admin'}, }; state.entities.preferences = { myPreferences: { 'to_paid_plan_nudge--nudge_to_paid_plan_snoozed': { category: 'to_paid_plan_nudge', name: 'nudge_to_paid_plan_snoozed', value: '{"range": 0, "show": false}', }, }, }; state.entities.cloud = { subscription: { product_id: 'prod_starter', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_starter: { id: 'prod_starter', sku: CloudProducts.STARTER, }, }, }; renderWithContext(<ToPaidPlanBannerDismissable/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-free-deprecation-announcement-bar')).toThrow(); }); }); describe('ToPaidNudgeBanner', () => { test('should show only for cloud free', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.cloud = { subscription: { product_id: 'prod_starter', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_starter: { id: 'prod_starter', sku: CloudProducts.STARTER, }, }, }; renderWithContext(<ToPaidNudgeBanner/>, state, {useMockedStore: true}); screen.getByTestId('cloud-free-deprecation-alert-banner'); }); test('should NOT show for cloud professional', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.cloud = { subscription: { product_id: 'prod_pro', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_pro: { id: 'prod_pro', sku: CloudProducts.PROFESSIONAL, }, }, }; renderWithContext(<ToPaidNudgeBanner/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-free-deprecation-alert-banner')).toThrow(); }); test('should NOT show for cloud enterprise', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.cloud = { subscription: { product_id: 'prod_ent', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_ent: { id: 'prod_ent', sku: CloudProducts.ENTERPRISE, }, }, }; renderWithContext(<ToPaidNudgeBanner/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-free-deprecation-alert-banner')).toThrow(); }); });
993
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/billing_subscriptions/to_yearly_nudge_banner.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import {renderWithContext, screen, waitFor} from 'tests/react_testing_utils'; import {CloudProducts, RecurringIntervals} from 'utils/constants'; import {ToYearlyNudgeBanner, ToYearlyNudgeBannerDismissable} from './to_yearly_nudge_banner'; const initialState = { views: { announcementBar: { announcementBarState: { announcementBarCount: 1, }, }, }, entities: { general: { config: { CWSURL: '', }, license: { IsLicensed: 'true', Cloud: 'true', }, }, users: { currentUserId: 'current_user_id', profiles: { current_user_id: {roles: 'system_user'}, }, }, preferences: { myPreferences: {}, }, cloud: {}, }, }; describe('ToYearlyNudgeBannerDismissable', () => { test('should show for admins cloud professional monthly', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_admin'}, }; state.entities.cloud = { subscription: { product_id: 'prod_professional', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_professional: { id: 'prod_professional', sku: CloudProducts.PROFESSIONAL, recurring_interval: RecurringIntervals.MONTH, }, }, }; renderWithContext(<ToYearlyNudgeBannerDismissable/>, state, {useMockedStore: true}); screen.getByTestId('cloud-pro-monthly-deprecation-announcement-bar'); }); test('should NOT show for NON admins', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_user'}, }; state.entities.cloud = { subscription: { product_id: 'prod_professional', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_professional: { id: 'prod_professional', sku: CloudProducts.PROFESSIONAL, recurring_interval: RecurringIntervals.MONTH, }, }, }; renderWithContext(<ToYearlyNudgeBannerDismissable/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-pro-monthly-deprecation-announcement-bar')).toThrow(); }); test('should NOT show for admins on cloud free', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_admin'}, }; state.entities.cloud = { subscription: { product_id: 'prod_starter', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_starter: { id: 'prod_starter', sku: CloudProducts.STARTER, recurring_interval: RecurringIntervals.MONTH, }, }, }; renderWithContext(<ToYearlyNudgeBannerDismissable/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-pro-monthly-deprecation-announcement-bar')).toThrow(); }); test('should NOT show for admins on cloud enterprise', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_admin'}, }; state.entities.cloud = { subscription: { product_id: 'prod_enterprise', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_enterprise: { id: 'prod_enterprise', sku: CloudProducts.ENTERPRISE, recurring_interval: RecurringIntervals.MONTH, }, }, }; renderWithContext(<ToYearlyNudgeBannerDismissable/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-pro-monthly-deprecation-announcement-bar')).toThrow(); }); test('should NOT show for admins on cloud pro annual', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_admin'}, }; state.entities.cloud = { subscription: { product_id: 'prod_pro', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_pro: { id: 'prod_pro', sku: CloudProducts.PROFESSIONAL, recurring_interval: RecurringIntervals.YEAR, }, }, }; renderWithContext(<ToYearlyNudgeBannerDismissable/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-pro-monthly-deprecation-announcement-bar')).toThrow(); }); test('should NOT show for admins when banner was dismissed in preferences', async () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_admin'}, }; state.entities.preferences = { myPreferences: { 'to_cloud_yearly_plan_nudge--nudge_to_cloud_yearly_plan_snoozed': { category: 'to_cloud_yearly_plan_nudge', name: 'nudge_to_cloud_yearly_plan_snoozed', value: '{"range": 0, "show": false}', }, }, }; state.entities.cloud = { subscription: { product_id: 'prod_professional', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_professional: { id: 'prod_professional', sku: CloudProducts.PROFESSIONAL, recurring_interval: RecurringIntervals.MONTH, }, }, }; await waitFor(() => { renderWithContext(<ToYearlyNudgeBannerDismissable/>, state, {useMockedStore: true}); }); expect(() => screen.getByTestId('cloud-pro-monthly-deprecation-announcement-bar')).toThrow(); }); test('should NOT show when subscription has billing type of internal', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_admin'}, }; state.entities.cloud = { subscription: { product_id: 'prod_professional', is_free_trial: 'false', trial_end_at: 1, billing_type: 'internal', }, products: { prod_professional: { id: 'prod_professional', sku: CloudProducts.PROFESSIONAL, recurring_interval: RecurringIntervals.MONTH, }, }, }; renderWithContext(<ToYearlyNudgeBannerDismissable/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-pro-monthly-deprecation-announcement-bar')).toThrow(); }); test('should NOT show when subscription has billing type of licensed', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.users.profiles = { current_user_id: {roles: 'system_admin'}, }; state.entities.cloud = { subscription: { product_id: 'prod_professional', is_free_trial: 'false', trial_end_at: 1, billing_type: 'licensed', }, products: { prod_professional: { id: 'prod_professional', sku: CloudProducts.PROFESSIONAL, recurring_interval: RecurringIntervals.MONTH, }, }, }; renderWithContext(<ToYearlyNudgeBannerDismissable/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-pro-monthly-deprecation-announcement-bar')).toThrow(); }); }); describe('ToYearlyNudgeBanner', () => { test('should show for cloud professional monthly', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.cloud = { subscription: { product_id: 'prod_professional', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_professional: { id: 'prod_professional', sku: CloudProducts.PROFESSIONAL, recurring_interval: RecurringIntervals.MONTH, }, }, }; renderWithContext(<ToYearlyNudgeBanner/>, state, {useMockedStore: true}); screen.getByTestId('cloud-pro-monthly-deprecation-alert-banner'); }); test('should NOT show for non cloud professional monthly', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.cloud = { subscription: { product_id: 'prod_starter', is_free_trial: 'false', trial_end_at: 1, }, products: { prod_starter: { id: 'prod_starter', sku: CloudProducts.STARTER, recurring_interval: RecurringIntervals.MONTH, }, }, }; renderWithContext(<ToYearlyNudgeBanner/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-pro-monthly-deprecation-alert-banner')).toThrow(); }); test('should NOT show when subscription has billing type of internal', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.cloud = { subscription: { product_id: 'prod_professional', is_free_trial: 'false', trial_end_at: 1, billing_type: 'internal', }, products: { prod_professional: { id: 'prod_professional', sku: CloudProducts.PROFESSIONAL, recurring_interval: RecurringIntervals.MONTH, }, }, }; renderWithContext(<ToYearlyNudgeBanner/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-pro-monthly-deprecation-alert-banner')).toThrow(); }); test('should NOT show when subscription has billing type of licensed', () => { const state = JSON.parse(JSON.stringify(initialState)); state.entities.cloud = { subscription: { product_id: 'prod_professional', is_free_trial: 'false', trial_end_at: 1, billing_type: 'licensed', }, products: { prod_professional: { id: 'prod_professional', sku: CloudProducts.PROFESSIONAL, recurring_interval: RecurringIntervals.MONTH, }, }, }; renderWithContext(<ToYearlyNudgeBanner/>, state, {useMockedStore: true}); expect(() => screen.getByTestId('cloud-pro-monthly-deprecation-alert-banner')).toThrow(); }); });
995
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/billing_subscriptions
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/billing_subscriptions/__snapshots__/cloud_trial_banner.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/billing_subscription/CloudTrialBanner should match snapshot when is cloud and is free trial (the trial end is passed) 1`] = ` <ContextProvider value={ Object { "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "subscription": Subscription { "handleChangeWrapper": [Function], "listeners": Object { "notify": [Function], }, "onStateChange": [Function], "parentSub": undefined, "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "unsubscribe": null, }, } } > <CloudTrialBanner trialEndDate={12345} /> </ContextProvider> `; exports[`components/admin_console/billing_subscription/CloudTrialBanner should match snapshot when no trial end date is passed 1`] = ` <ContextProvider value={ Object { "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "subscription": Subscription { "handleChangeWrapper": [Function], "listeners": Object { "notify": [Function], }, "onStateChange": [Function], "parentSub": undefined, "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "unsubscribe": null, }, } } > <CloudTrialBanner trialEndDate={0} /> </ContextProvider> `; exports[`components/admin_console/billing_subscription/CloudTrialBanner should match snapshot when there is an stored preference value 1`] = ` <ContextProvider value={ Object { "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "subscription": Subscription { "handleChangeWrapper": [Function], "listeners": Object { "notify": [Function], }, "onStateChange": [Function], "parentSub": undefined, "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "unsubscribe": null, }, } } > <CloudTrialBanner trialEndDate={12345} /> </ContextProvider> `;
1,013
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/plan_details/feature_list.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import {Provider} from 'react-redux'; import {mountWithIntl} from 'tests/helpers/intl-test-helper'; import mockStore from 'tests/test_store'; import {CloudProducts} from 'utils/constants'; import {makeEmptyLimits, makeEmptyUsage} from 'utils/limits_test'; import FeatureList from './feature_list'; import type {FeatureListProps} from './feature_list'; function renderFeatureList(props: FeatureListProps, deep?: boolean) { const state = { entities: { general: { license: {}, }, cloud: { limits: makeEmptyLimits(), }, usage: makeEmptyUsage(), users: { currentUserId: 'uid', profiles: { uid: {}, }, }, }, }; const store = mockStore(state); const wrapper = deep ? mountWithIntl( <Provider store={store}> <FeatureList {...props}/> </Provider>, ) : shallow( <Provider store={store}> <FeatureList {...props}/> </Provider>, ); return wrapper; } describe('components/admin_console/billing/plan_details/feature_list', () => { test('should match snapshot when running FREE tier', () => { const wrapper = renderFeatureList({ subscriptionPlan: CloudProducts.STARTER, }); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot when running paid tier and professional', () => { const wrapper = renderFeatureList({ subscriptionPlan: CloudProducts.PROFESSIONAL, }); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot when running paid tier and enterprise', () => { const wrapper = renderFeatureList({ subscriptionPlan: CloudProducts.ENTERPRISE, }); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot when running paid tier and free', () => { const wrapper = renderFeatureList({ subscriptionPlan: CloudProducts.STARTER, }); expect(wrapper).toMatchSnapshot(); }); test('all feature items must have different values', () => { const wrapperEnterprise = renderFeatureList({ subscriptionPlan: CloudProducts.ENTERPRISE, }, true); const wrapperStarter = renderFeatureList({ subscriptionPlan: CloudProducts.STARTER, }, true); const wrapperProfessional = renderFeatureList({ subscriptionPlan: CloudProducts.PROFESSIONAL, }, true); const wrapperFreeTier = renderFeatureList({ subscriptionPlan: CloudProducts.PROFESSIONAL, }, true); const wrappers = [wrapperProfessional, wrapperEnterprise, wrapperStarter, wrapperFreeTier]; wrappers.forEach((wrapper: ReturnType<typeof renderFeatureList>) => { const featuresSpanElements = wrapper.find('div.PlanDetailsFeature > span'); if (featuresSpanElements.length === 0) { console.error('No features found'); expect(featuresSpanElements.length).toBeTruthy(); return; } const featuresTexts = featuresSpanElements.map((element: any) => element.text()); const hasDuplicates = (arr: any[]) => arr.length !== new Set(arr).size; expect(hasDuplicates(featuresTexts)).toBeFalsy(); }); }); });
1,020
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/plan_details
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/billing/plan_details/__snapshots__/feature_list.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/billing/plan_details/feature_list should match snapshot when running FREE tier 1`] = ` <ContextProvider value={ Object { "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "subscription": Subscription { "handleChangeWrapper": [Function], "listeners": Object { "notify": [Function], }, "onStateChange": [Function], "parentSub": undefined, "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "unsubscribe": null, }, } } > <FeatureList subscriptionPlan="cloud-starter" /> </ContextProvider> `; exports[`components/admin_console/billing/plan_details/feature_list should match snapshot when running paid tier and enterprise 1`] = ` <ContextProvider value={ Object { "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "subscription": Subscription { "handleChangeWrapper": [Function], "listeners": Object { "notify": [Function], }, "onStateChange": [Function], "parentSub": undefined, "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "unsubscribe": null, }, } } > <FeatureList subscriptionPlan="cloud-enterprise" /> </ContextProvider> `; exports[`components/admin_console/billing/plan_details/feature_list should match snapshot when running paid tier and free 1`] = ` <ContextProvider value={ Object { "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "subscription": Subscription { "handleChangeWrapper": [Function], "listeners": Object { "notify": [Function], }, "onStateChange": [Function], "parentSub": undefined, "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "unsubscribe": null, }, } } > <FeatureList subscriptionPlan="cloud-starter" /> </ContextProvider> `; exports[`components/admin_console/billing/plan_details/feature_list should match snapshot when running paid tier and professional 1`] = ` <ContextProvider value={ Object { "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "subscription": Subscription { "handleChangeWrapper": [Function], "listeners": Object { "notify": [Function], }, "onStateChange": [Function], "parentSub": undefined, "store": Object { "clearActions": [Function], "dispatch": [Function], "getActions": [Function], "getState": [Function], "replaceReducer": [Function], "subscribe": [Function], }, "unsubscribe": null, }, } } > <FeatureList subscriptionPlan="cloud-professional" /> </ContextProvider> `;
1,023
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/brand_image_setting/brand_image_setting.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import {Client4} from 'mattermost-redux/client'; import {uploadBrandImage, deleteBrandImage} from 'actions/admin_actions.jsx'; import BrandImageSetting from './brand_image_setting'; jest.mock('actions/admin_actions.jsx', () => ({ ...jest.requireActual('actions/admin_actions.jsx'), uploadBrandImage: jest.fn(), deleteBrandImage: jest.fn(), })); Client4.setUrl('http://localhost:8065'); describe('components/admin_console/brand_image_setting', () => { const baseProps = { disabled: false, setSaveNeeded: jest.fn(), registerSaveAction: jest.fn(), unRegisterSaveAction: jest.fn(), }; test('should have called deleteBrandImage or uploadBrandImage on save depending on component state', () => { const wrapper = shallow<BrandImageSetting>( <BrandImageSetting {...baseProps}/>, ); const instance = wrapper.instance(); wrapper.setState({deleteBrandImage: false, brandImage: new Blob(['brand_image_file'])}); instance.handleSave(); expect(deleteBrandImage).toHaveBeenCalledTimes(0); expect(uploadBrandImage).toHaveBeenCalledTimes(1); wrapper.setState({deleteBrandImage: true, brandImage: undefined}); instance.handleSave(); expect(deleteBrandImage).toHaveBeenCalledTimes(1); expect(uploadBrandImage).toHaveBeenCalledTimes(1); }); });
1,027
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/custom_plugin_settings/custom_plugin_settings.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import type {PluginSettings} from '@mattermost/types/config'; import type {PluginRedux} from '@mattermost/types/plugins'; import CustomPluginSettings from 'components/admin_console/custom_plugin_settings/custom_plugin_settings'; import SchemaAdminSettings from 'components/admin_console/schema_admin_settings'; describe('components/admin_console/CustomPluginSettings', () => { let plugin: PluginRedux = {} as PluginRedux; let config: {PluginSettings: Partial<PluginSettings>} = {PluginSettings: {}}; beforeEach(() => { plugin = { id: 'testplugin', name: 'testplugin', description: '', version: '', active: true, webapp: { bundle_path: '/static/testplugin_bundle.js', }, settings_schema: { header: '# Header\n*This* is the **header**', footer: '# Footer\n*This* is the **footer**', settings: [ { key: 'settinga', display_name: 'Setting One', type: 'text', default: 'setting_default', help_text: 'This is some help text for the text field.', placeholder: 'e.g. some setting', }, { key: 'settingb', display_name: 'Setting Two', type: 'bool', default: true, help_text: 'This is some help text for the bool field.', placeholder: 'e.g. some setting', }, { key: 'settingc', display_name: 'Setting Three', type: 'dropdown', default: 'option1', options: [ {display_name: 'Option 1', value: 'option1'}, {display_name: 'Option 2', value: 'option2'}, {display_name: 'Option 3', value: 'option3'}, ], help_text: 'This is some help text for the dropdown field.', placeholder: 'e.g. some setting', }, { key: 'settingd', display_name: 'Setting Four', type: 'radio', default: 'option2', options: [ {display_name: 'Option 1', value: 'option1'}, {display_name: 'Option 2', value: 'option2'}, {display_name: 'Option 3', value: 'option3'}, ], help_text: 'This is some help text for the radio field.', placeholder: 'e.g. some setting', }, { key: 'settinge', display_name: 'Setting Five', type: 'generated', default: 'option3', help_text: 'This is some help text for the generated field.', regenerate_help_text: 'This is help text for the regenerate button.', placeholder: 'e.g. 47KyfOxtk5+ovi1MDHFyzMDHIA6esMWb', }, { key: 'settingf', display_name: 'Setting Six', type: 'username', default: 'option4', help_text: 'This is some help text for the user autocomplete field.', placeholder: 'Type a username here', }, ], }, }; config = { PluginSettings: { Plugins: { testplugin: { settinga: 'fsdsdg', settingb: false, settingc: 'option3', settingd: 'option1', settinge: 'Q6DHXrFLOIS5sOI5JNF4PyDLqWm7vh23', settingf: '3xz3r6n7dtbbmgref3yw4zg7sr', }, }, }, }; }); test('should match snapshot with settings and plugin', () => { const settings = plugin && plugin.settings_schema && plugin.settings_schema.settings && plugin.settings_schema.settings.map((setting) => { const escapedPluginId = SchemaAdminSettings.escapePathPart(plugin.id); return { ...setting, key: 'PluginSettings.Plugins.' + escapedPluginId + '.' + setting.key.toLowerCase(), label: setting.display_name, }; }); const wrapper = shallow( <CustomPluginSettings config={config} schema={{...plugin.settings_schema, id: plugin.id, name: plugin.name, translate: false, settings}} updateConfig={jest.fn()} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with settings and no plugin', () => { const wrapper = shallow( <CustomPluginSettings config={config} schema={{ id: 'testplugin', name: 'testplugin', translate: false, }} updateConfig={jest.fn()} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with no settings and plugin', () => { const settings = plugin && plugin.settings_schema && plugin.settings_schema.settings && plugin.settings_schema.settings.map((setting) => { return {...setting, label: setting.display_name}; }); const wrapper = shallow( <CustomPluginSettings config={{ PluginSettings: { Plugins: {}, }, }} schema={{...plugin.settings_schema, id: plugin.id, name: plugin.name, translate: false, settings}} updateConfig={jest.fn()} />, ); expect(wrapper).toMatchSnapshot(); }); });
1,031
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/custom_plugin_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/custom_plugin_settings/__snapshots__/custom_plugin_settings.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/CustomPluginSettings should match snapshot with no settings and plugin 1`] = ` <div className="wrapper--fixed " > <AdminHeader> testplugin </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <form className="form-horizontal" onSubmit={[Function]} role="form" > <SettingsGroup container={false} > <div className="banner" > <SchemaText isMarkdown={true} isTranslated={false} text="# Header *This* is the **header**" /> </div> <AdminTextSetting disabled={false} footer={null} helpText={ <SchemaText isTranslated={true} text="This is some help text for the text field." /> } id="settinga" key="testplugin_text_settinga" label="Setting One" onChange={[Function]} placeholder="e.g. some setting" setByEnv={false} type="input" value="setting_default" /> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <SchemaText isTranslated={true} text="This is some help text for the bool field." /> } id="settingb" key="testplugin_bool_settingb" label="Setting Two" onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={true} /> <Memo(DropdownSetting) disabled={false} helpText={ <SchemaText isTranslated={true} text="This is some help text for the dropdown field." /> } id="settingc" key="testplugin_dropdown_settingc" label="Setting Three" onChange={[Function]} setByEnv={false} value="option1" values={ Array [ Object { "text": "Option 1", "value": "option1", }, Object { "text": "Option 2", "value": "option2", }, Object { "text": "Option 3", "value": "option3", }, ] } /> <RadioSetting disabled={false} helpText={ <SchemaText isTranslated={true} text="This is some help text for the radio field." /> } id="settingd" key="testplugin_radio_settingd" label="Setting Four" onChange={[Function]} setByEnv={false} value="option2" values={ Array [ Object { "text": "Option 1", "value": "option1", }, Object { "text": "Option 2", "value": "option2", }, Object { "text": "Option 3", "value": "option3", }, ] } /> <GeneratedSetting disabled={false} helpText={ <SchemaText isTranslated={true} text="This is some help text for the generated field." /> } id="settinge" key="testplugin_generated_settinge" label="Setting Five" onChange={[Function]} placeholder="e.g. 47KyfOxtk5+ovi1MDHFyzMDHIA6esMWb" regenerateHelpText="This is help text for the regenerate button." regenerateText={ <Memo(MemoizedFormattedMessage) defaultMessage="Regenerate" id="admin.regenerate" /> } setByEnv={false} value="option3" /> <Connect(UserAutocompleteSetting) disabled={false} helpText={ <SchemaText isTranslated={true} text="This is some help text for the user autocomplete field." /> } id="settingf" key="testplugin_userautocomplete_settingf" label="Setting Six" onChange={[Function]} placeholder="Type a username here" value="option4" /> <div className="banner" > <SchemaText isMarkdown={true} isTranslated={false} text="# Footer *This* is the **footer**" /> </div> </SettingsGroup> </form> </div> </div> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" data-testid="errorMessage" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error="" errors={Array []} iconClassName="fa-exclamation-triangle" textClassName="has-warning" /> <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} delayShow={400} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> `; exports[`components/admin_console/CustomPluginSettings should match snapshot with settings and no plugin 1`] = ` <div className="wrapper--fixed " > <AdminHeader> testplugin </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <form className="form-horizontal" onSubmit={[Function]} role="form" /> </div> </div> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" data-testid="errorMessage" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error="" errors={Array []} iconClassName="fa-exclamation-triangle" textClassName="has-warning" /> <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} delayShow={400} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> `; exports[`components/admin_console/CustomPluginSettings should match snapshot with settings and plugin 1`] = ` <div className="wrapper--fixed " > <AdminHeader> testplugin </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <form className="form-horizontal" onSubmit={[Function]} role="form" > <SettingsGroup container={false} > <div className="banner" > <SchemaText isMarkdown={true} isTranslated={false} text="# Header *This* is the **header**" /> </div> <AdminTextSetting disabled={false} footer={null} helpText={ <SchemaText isTranslated={true} text="This is some help text for the text field." /> } id="PluginSettings.Plugins.testplugin.settinga" key="testplugin_text_PluginSettings.Plugins.testplugin.settinga" label="Setting One" onChange={[Function]} placeholder="e.g. some setting" setByEnv={false} type="input" value="fsdsdg" /> <BooleanSetting disabled={false} falseText={ <Memo(MemoizedFormattedMessage) defaultMessage="false" id="admin.false" /> } helpText={ <SchemaText isTranslated={true} text="This is some help text for the bool field." /> } id="PluginSettings.Plugins.testplugin.settingb" key="testplugin_bool_PluginSettings.Plugins.testplugin.settingb" label="Setting Two" onChange={[Function]} setByEnv={false} trueText={ <Memo(MemoizedFormattedMessage) defaultMessage="true" id="admin.true" /> } value={false} /> <Memo(DropdownSetting) disabled={false} helpText={ <SchemaText isTranslated={true} text="This is some help text for the dropdown field." /> } id="PluginSettings.Plugins.testplugin.settingc" key="testplugin_dropdown_PluginSettings.Plugins.testplugin.settingc" label="Setting Three" onChange={[Function]} setByEnv={false} value="option3" values={ Array [ Object { "text": "Option 1", "value": "option1", }, Object { "text": "Option 2", "value": "option2", }, Object { "text": "Option 3", "value": "option3", }, ] } /> <RadioSetting disabled={false} helpText={ <SchemaText isTranslated={true} text="This is some help text for the radio field." /> } id="PluginSettings.Plugins.testplugin.settingd" key="testplugin_radio_PluginSettings.Plugins.testplugin.settingd" label="Setting Four" onChange={[Function]} setByEnv={false} value="option1" values={ Array [ Object { "text": "Option 1", "value": "option1", }, Object { "text": "Option 2", "value": "option2", }, Object { "text": "Option 3", "value": "option3", }, ] } /> <GeneratedSetting disabled={false} helpText={ <SchemaText isTranslated={true} text="This is some help text for the generated field." /> } id="PluginSettings.Plugins.testplugin.settinge" key="testplugin_generated_PluginSettings.Plugins.testplugin.settinge" label="Setting Five" onChange={[Function]} placeholder="e.g. 47KyfOxtk5+ovi1MDHFyzMDHIA6esMWb" regenerateHelpText="This is help text for the regenerate button." regenerateText={ <Memo(MemoizedFormattedMessage) defaultMessage="Regenerate" id="admin.regenerate" /> } setByEnv={false} value="Q6DHXrFLOIS5sOI5JNF4PyDLqWm7vh23" /> <Connect(UserAutocompleteSetting) disabled={false} helpText={ <SchemaText isTranslated={true} text="This is some help text for the user autocomplete field." /> } id="PluginSettings.Plugins.testplugin.settingf" key="testplugin_userautocomplete_PluginSettings.Plugins.testplugin.settingf" label="Setting Six" onChange={[Function]} placeholder="Type a username here" value="3xz3r6n7dtbbmgref3yw4zg7sr" /> <div className="banner" > <SchemaText isMarkdown={true} isTranslated={false} text="# Footer *This* is the **footer**" /> </div> </SettingsGroup> </form> </div> </div> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" data-testid="errorMessage" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error="" errors={Array []} iconClassName="fa-exclamation-triangle" textClassName="has-warning" /> <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} delayShow={400} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> `;
1,032
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/custom_terms_of_service_settings/custom_terms_of_service_settings.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import type {AdminConfig} from '@mattermost/types/config'; import CustomTermsOfServiceSettings from 'components/admin_console/custom_terms_of_service_settings/custom_terms_of_service_settings'; describe('components/admin_console/CustomTermsOfServiceSettings', () => { const baseProps = { actions: { createTermsOfService: jest.fn(), getTermsOfService: jest.fn().mockResolvedValue({data: {id: 'tos_id', text: 'tos_text'}}), }, config: { SupportSettings: { CustomTermsOfServiceEnabled: true, CustomTermsOfServiceReAcceptancePeriod: 365, }, } as AdminConfig, license: { IsLicensed: 'true', CustomTermsOfService: 'true', }, setNavigationBlocked: jest.fn(), updateConfig: jest.fn(), }; test('should match snapshot', () => { const wrapper = shallow( <CustomTermsOfServiceSettings {...baseProps} />, ); expect(wrapper).toMatchSnapshot(); wrapper.setProps({saveNeeded: true}); expect(wrapper).toMatchSnapshot(); wrapper.setProps({saveNeeded: false, saving: true}); expect(wrapper).toMatchSnapshot(); wrapper.setProps({saving: false, serverError: 'error'}); expect(wrapper).toMatchSnapshot(); }); });
1,035
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/custom_terms_of_service_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/custom_terms_of_service_settings/__snapshots__/custom_terms_of_service_settings.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/CustomTermsOfServiceSettings should match snapshot 1`] = ` <form className="form-horizontal" onSubmit={[Function]} role="form" > <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Custom Terms of Service" id="admin.support.termsOfServiceTitle" /> </AdminHeader> <LoadingScreen /> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> </form> `; exports[`components/admin_console/CustomTermsOfServiceSettings should match snapshot 2`] = ` <form className="form-horizontal" onSubmit={[Function]} role="form" > <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Custom Terms of Service" id="admin.support.termsOfServiceTitle" /> </AdminHeader> <LoadingScreen /> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> </form> `; exports[`components/admin_console/CustomTermsOfServiceSettings should match snapshot 3`] = ` <form className="form-horizontal" onSubmit={[Function]} role="form" > <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Custom Terms of Service" id="admin.support.termsOfServiceTitle" /> </AdminHeader> <LoadingScreen /> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> </form> `; exports[`components/admin_console/CustomTermsOfServiceSettings should match snapshot 4`] = ` <form className="form-horizontal" onSubmit={[Function]} role="form" > <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Custom Terms of Service" id="admin.support.termsOfServiceTitle" /> </AdminHeader> <LoadingScreen /> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="save_button.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage="Saving Config..." /> <div className="error-message" onMouseOut={[Function]} onMouseOver={[Function]} > <FormError error={null} errors={Array []} /> </div> <Overlay animation={[Function]} placement="top" rootClose={false} show={false} target={null} > <Tooltip id="error-tooltip" /> </Overlay> </div> </div> </form> `;
1,037
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_grid/data_grid.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import DataGrid from './data_grid'; describe('components/admin_console/data_grid/DataGrid', () => { const baseProps = { page: 1, startCount: 0, endCount: 0, total: 0, loading: false, nextPage: jest.fn(), previousPage: jest.fn(), onSearch: jest.fn(), rows: [], columns: [], term: '', }; test('should match snapshot with no items found', () => { const wrapper = shallow( <DataGrid {...baseProps} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot while loading', () => { const wrapper = shallow( <DataGrid {...baseProps} loading={true} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with content and custom styling on rows', () => { const wrapper = shallow( <DataGrid {...baseProps} rows={[ {cells: {name: 'Joe Schmoe', team: 'Admin Team'}}, {cells: {name: 'Foo Bar', team: 'Admin Team'}}, {cells: {name: 'Some Guy', team: 'Admin Team'}}, ]} columns={[ {name: 'Name', field: 'name', width: 3, overflow: 'hidden'}, {name: 'Team', field: 'team', textAlign: 'center'}, ]} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with custom classes', () => { const wrapper = shallow( <DataGrid {...baseProps} rows={[ {cells: {name: 'Joe Schmoe', team: 'Admin Team'}}, {cells: {name: 'Foo Bar', team: 'Admin Team'}}, {cells: {name: 'Some Guy', team: 'Admin Team'}}, ]} columns={[ {name: 'Name', field: 'name'}, {name: 'Team', field: 'team'}, ]} className={'customTable'} />, ); expect(wrapper).toMatchSnapshot(); }); });
1,042
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_grid
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_grid/__snapshots__/data_grid.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/data_grid/DataGrid should match snapshot while loading 1`] = ` <div className="DataGrid" > <DataGridSearch onSearch={[Function]} placeholder="" term="" /> <DataGridHeader columns={Array []} /> <div className="DataGrid_rows" style={Object {}} > <div className="DataGrid_loading" > <Memo(LoadingSpinner) /> <MemoizedFormattedMessage defaultMessage="Loading" id="admin.data_grid.loading" /> </div> </div> </div> `; exports[`components/admin_console/data_grid/DataGrid should match snapshot with content and custom styling on rows 1`] = ` <div className="DataGrid" > <DataGridSearch onSearch={[Function]} placeholder="" term="" /> <DataGridHeader columns={ Array [ Object { "field": "name", "name": "Name", "overflow": "hidden", "width": 3, }, Object { "field": "team", "name": "Team", "textAlign": "center", }, ] } /> <div className="DataGrid_rows" style={Object {}} > <Memo(DataGridRow) columns={ Array [ Object { "field": "name", "name": "Name", "overflow": "hidden", "width": 3, }, Object { "field": "team", "name": "Team", "textAlign": "center", }, ] } key="0" row={ Object { "cells": Object { "name": "Joe Schmoe", "team": "Admin Team", }, } } /> <Memo(DataGridRow) columns={ Array [ Object { "field": "name", "name": "Name", "overflow": "hidden", "width": 3, }, Object { "field": "team", "name": "Team", "textAlign": "center", }, ] } key="1" row={ Object { "cells": Object { "name": "Foo Bar", "team": "Admin Team", }, } } /> <Memo(DataGridRow) columns={ Array [ Object { "field": "name", "name": "Name", "overflow": "hidden", "width": 3, }, Object { "field": "team", "name": "Team", "textAlign": "center", }, ] } key="2" row={ Object { "cells": Object { "name": "Some Guy", "team": "Admin Team", }, } } /> </div> </div> `; exports[`components/admin_console/data_grid/DataGrid should match snapshot with custom classes 1`] = ` <div className="DataGrid customTable" > <DataGridSearch onSearch={[Function]} placeholder="" term="" /> <DataGridHeader columns={ Array [ Object { "field": "name", "name": "Name", }, Object { "field": "team", "name": "Team", }, ] } /> <div className="DataGrid_rows" style={Object {}} > <Memo(DataGridRow) columns={ Array [ Object { "field": "name", "name": "Name", }, Object { "field": "team", "name": "Team", }, ] } key="0" row={ Object { "cells": Object { "name": "Joe Schmoe", "team": "Admin Team", }, } } /> <Memo(DataGridRow) columns={ Array [ Object { "field": "name", "name": "Name", }, Object { "field": "team", "name": "Team", }, ] } key="1" row={ Object { "cells": Object { "name": "Foo Bar", "team": "Admin Team", }, } } /> <Memo(DataGridRow) columns={ Array [ Object { "field": "name", "name": "Name", }, Object { "field": "team", "name": "Team", }, ] } key="2" row={ Object { "cells": Object { "name": "Some Guy", "team": "Admin Team", }, } } /> </div> </div> `; exports[`components/admin_console/data_grid/DataGrid should match snapshot with no items found 1`] = ` <div className="DataGrid" > <DataGridSearch onSearch={[Function]} placeholder="" term="" /> <DataGridHeader columns={Array []} /> <div className="DataGrid_rows" style={Object {}} > <div className="DataGrid_empty" > <MemoizedFormattedMessage defaultMessage="No items found" id="admin.data_grid.empty" /> </div> </div> </div> `;
1,044
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/data_retention_settings.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import DataRetentionSettings from './data_retention_settings'; describe('components/admin_console/data_retention_settings/data_retention_settings', () => { const baseProps = { config: { DataRetentionSettings: { EnableMessageDeletion: true, EnableFileDeletion: true, MessageRetentionDays: 100, FileRetentionDays: 100, DeletionJobStartTime: '00:15', }, }, customPolicies: {}, customPoliciesCount: 0, actions: { getDataRetentionCustomPolicies: jest.fn().mockResolvedValue([]), createJob: jest.fn(), getJobsByType: jest.fn().mockResolvedValue([]), deleteDataRetentionCustomPolicy: jest.fn(), updateConfig: jest.fn(), }, }; test('should match snapshot with no custom policies', () => { const wrapper = shallow( <DataRetentionSettings {...baseProps} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with custom policy', () => { const props = baseProps; props.customPolicies = { 1234567: { id: '1234567', display_name: 'Custom policy 1', post_duration: 60, team_count: 1, channel_count: 2, }, }; props.customPoliciesCount = 1; const wrapper = shallow( <DataRetentionSettings {...props} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with custom policy keep forever', () => { const props = baseProps; props.customPolicies = { 1234567: { id: '1234567', display_name: 'Custom policy 1', post_duration: -1, team_count: 1, channel_count: 2, }, }; props.customPoliciesCount = 1; const wrapper = shallow( <DataRetentionSettings {...props} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with Global Policies disabled', () => { const props = baseProps; props.config.DataRetentionSettings.EnableMessageDeletion = false; props.config.DataRetentionSettings.EnableFileDeletion = false; const wrapper = shallow( <DataRetentionSettings {...props} />, ); expect(wrapper).toMatchSnapshot(); }); });
1,047
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/__snapshots__/data_retention_settings.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/data_retention_settings/data_retention_settings should match snapshot with Global Policies disabled 1`] = ` <div className="wrapper--fixed DataRetentionSettings" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Data Retention Policies" id="admin.data_retention.settings.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Keep messages and files for a set amount of time." id="admin.data_retention.globalPolicy.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Global retention policy" id="admin.data_retention.globalPolicy.title" /> } /> </CardHeader> <CardBody expanded={true} > <div id="global_policy_table" > <DataGrid className="customTable" columns={ Array [ Object { "field": "description", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Description" id="admin.data_retention.globalPoliciesTable.description" />, }, Object { "field": "channel_messages", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Channel messages" id="admin.data_retention.globalPoliciesTable.channelMessages" />, }, Object { "field": "files", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Files" id="admin.data_retention.globalPoliciesTable.files" />, }, Object { "className": "actionIcon", "field": "actions", "name": "", }, ] } endCount={4} loading={false} nextPage={[Function]} page={0} previousPage={[Function]} rows={ Array [ Object { "cells": Object { "actions": <MenuWrapper animationComponent={[Function]} className="" isDisabled={false} stopPropagationOnToggle={true} > <div className="text-right" > <a> <i className="icon icon-dots-vertical" /> </a> </div> <Menu ariaLabel="User Actions Menu" openLeft={false} openUp={false} > <MenuItemAction buttonClass="edit_global_policy" disabled={false} onClick={[Function]} show={true} text="Edit" /> </Menu> </MenuWrapper>, "channel_messages": <div data-testid="global_message_retention_cell" > <Memo(MemoizedFormattedMessage) defaultMessage="Keep forever" id="admin.data_retention.form.keepForever" /> </div>, "description": "Applies to all teams and channels, but does not apply to custom retention policies.", "files": <div data-testid="global_file_retention_cell" > <Memo(MemoizedFormattedMessage) defaultMessage="Keep forever" id="admin.data_retention.form.keepForever" /> </div>, }, "onClick": [Function], }, ] } searchPlaceholder="" startCount={1} term="" total={0} /> </div> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Add policy" id="admin.data_retention.customPolicies.addPolicy" /> } onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Customize how long specific teams and channels will keep messages." id="admin.data_retention.customPolicies.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Custom retention policies" id="admin.data_retention.customPolicies.title" /> } /> </CardHeader> <CardBody expanded={true} > <div id="custom_policy_table" > <DataGrid className="customTable" columns={ Array [ Object { "field": "description", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Description" id="admin.data_retention.customPoliciesTable.description" />, }, Object { "field": "channel_messages", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Channel messages" id="admin.data_retention.customPoliciesTable.channelMessages" />, }, Object { "field": "applied_to", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Applied to" id="admin.data_retention.customPoliciesTable.appliedTo" />, }, Object { "className": "actionIcon", "field": "actions", "name": "", }, ] } endCount={1} loading={true} nextPage={[Function]} page={0} previousPage={[Function]} rows={ Array [ Object { "cells": Object { "actions": <MenuWrapper animationComponent={[Function]} className="" id="customWrapper-1234567" isDisabled={false} stopPropagationOnToggle={true} > <div className="text-right" > <a> <i className="icon icon-dots-vertical" /> </a> </div> <Menu ariaLabel="User Actions Menu" openLeft={false} openUp={false} > <MenuItemAction disabled={false} onClick={[Function]} show={true} text="Edit" /> <MenuItemAction disabled={false} onClick={[Function]} show={true} text="Delete" /> </Menu> </MenuWrapper>, "applied_to": <div id="customAppliedTo-1234567" > <Memo(MemoizedFormattedMessage) defaultMessage="{team_count} {team_count, plural, one {team} other {teams}}, {channel_count} {channel_count, plural, one {channel} other {channels}}" id="admin.data_retention.channel_team_counts" values={ Object { "channel_count": 2, "team_count": 1, } } /> </div>, "channel_messages": <div id="customDuration-1234567" > <Memo(MemoizedFormattedMessage) defaultMessage="Keep forever" id="admin.data_retention.form.keepForever" /> </div>, "description": <div id="customDescription-1234567" > Custom policy 1 </div>, }, "onClick": [Function], }, ] } searchPlaceholder="" startCount={1} term="" total={1} /> </div> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Run Deletion Job Now" id="admin.data_retention.createJob.title" /> } isDisabled={false} onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Daily log of messages and files removed based on the policies defined above." id="admin.data_retention.jobCreation.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Policy log" id="admin.data_retention.jobCreation.title" /> } /> </CardHeader> <CardBody expanded={true} > <Connect(JobTable) className="job-table__data-retention" createJobButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Run Deletion Job Now" id="admin.data_retention.createJob.title" /> } createJobHelpText={ <div> <Memo(MemoizedFormattedMessage) defaultMessage="Daily time to check policies and run delete job:" id="admin.data_retention.createJob.instructions" /> <span className="JobSelectedtime" > <b> <Memo(MemoizedFormattedMessage) defaultMessage="{time} AM (UTC)" id="admin.data_retention.jobTimeAM" values={ Object { "time": "12:15", } } /> </b> </span> <a className="EditJobTime" onClick={[Function]} > Edit </a> </div> } disabled={true} hideJobCreateButton={true} jobType="data_retention" /> </CardBody> </Card> </div> </div> </div> `; exports[`components/admin_console/data_retention_settings/data_retention_settings should match snapshot with custom policy 1`] = ` <div className="wrapper--fixed DataRetentionSettings" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Data Retention Policies" id="admin.data_retention.settings.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Keep messages and files for a set amount of time." id="admin.data_retention.globalPolicy.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Global retention policy" id="admin.data_retention.globalPolicy.title" /> } /> </CardHeader> <CardBody expanded={true} > <div id="global_policy_table" > <DataGrid className="customTable" columns={ Array [ Object { "field": "description", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Description" id="admin.data_retention.globalPoliciesTable.description" />, }, Object { "field": "channel_messages", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Channel messages" id="admin.data_retention.globalPoliciesTable.channelMessages" />, }, Object { "field": "files", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Files" id="admin.data_retention.globalPoliciesTable.files" />, }, Object { "className": "actionIcon", "field": "actions", "name": "", }, ] } endCount={4} loading={false} nextPage={[Function]} page={0} previousPage={[Function]} rows={ Array [ Object { "cells": Object { "actions": <MenuWrapper animationComponent={[Function]} className="" isDisabled={false} stopPropagationOnToggle={true} > <div className="text-right" > <a> <i className="icon icon-dots-vertical" /> </a> </div> <Menu ariaLabel="User Actions Menu" openLeft={false} openUp={false} > <MenuItemAction buttonClass="edit_global_policy" disabled={false} onClick={[Function]} show={true} text="Edit" /> </Menu> </MenuWrapper>, "channel_messages": <div data-testid="global_message_retention_cell" > <Memo(MemoizedFormattedMessage) defaultMessage="{count} {count, plural, one {day} other {days}}" id="admin.data_retention.retention_days" values={ Object { "count": "100", } } /> </div>, "description": "Applies to all teams and channels, but does not apply to custom retention policies.", "files": <div data-testid="global_file_retention_cell" > <Memo(MemoizedFormattedMessage) defaultMessage="{count} {count, plural, one {day} other {days}}" id="admin.data_retention.retention_days" values={ Object { "count": "100", } } /> </div>, }, "onClick": [Function], }, ] } searchPlaceholder="" startCount={1} term="" total={0} /> </div> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Add policy" id="admin.data_retention.customPolicies.addPolicy" /> } onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Customize how long specific teams and channels will keep messages." id="admin.data_retention.customPolicies.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Custom retention policies" id="admin.data_retention.customPolicies.title" /> } /> </CardHeader> <CardBody expanded={true} > <div id="custom_policy_table" > <DataGrid className="customTable" columns={ Array [ Object { "field": "description", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Description" id="admin.data_retention.customPoliciesTable.description" />, }, Object { "field": "channel_messages", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Channel messages" id="admin.data_retention.customPoliciesTable.channelMessages" />, }, Object { "field": "applied_to", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Applied to" id="admin.data_retention.customPoliciesTable.appliedTo" />, }, Object { "className": "actionIcon", "field": "actions", "name": "", }, ] } endCount={1} loading={true} nextPage={[Function]} page={0} previousPage={[Function]} rows={ Array [ Object { "cells": Object { "actions": <MenuWrapper animationComponent={[Function]} className="" id="customWrapper-1234567" isDisabled={false} stopPropagationOnToggle={true} > <div className="text-right" > <a> <i className="icon icon-dots-vertical" /> </a> </div> <Menu ariaLabel="User Actions Menu" openLeft={false} openUp={false} > <MenuItemAction disabled={false} onClick={[Function]} show={true} text="Edit" /> <MenuItemAction disabled={false} onClick={[Function]} show={true} text="Delete" /> </Menu> </MenuWrapper>, "applied_to": <div id="customAppliedTo-1234567" > <Memo(MemoizedFormattedMessage) defaultMessage="{team_count} {team_count, plural, one {team} other {teams}}, {channel_count} {channel_count, plural, one {channel} other {channels}}" id="admin.data_retention.channel_team_counts" values={ Object { "channel_count": 2, "team_count": 1, } } /> </div>, "channel_messages": <div id="customDuration-1234567" > <Memo(MemoizedFormattedMessage) defaultMessage="{count} {count, plural, one {day} other {days}}" id="admin.data_retention.retention_days" values={ Object { "count": "60", } } /> </div>, "description": <div id="customDescription-1234567" > Custom policy 1 </div>, }, "onClick": [Function], }, ] } searchPlaceholder="" startCount={1} term="" total={1} /> </div> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Run Deletion Job Now" id="admin.data_retention.createJob.title" /> } isDisabled={false} onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Daily log of messages and files removed based on the policies defined above." id="admin.data_retention.jobCreation.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Policy log" id="admin.data_retention.jobCreation.title" /> } /> </CardHeader> <CardBody expanded={true} > <Connect(JobTable) className="job-table__data-retention" createJobButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Run Deletion Job Now" id="admin.data_retention.createJob.title" /> } createJobHelpText={ <div> <Memo(MemoizedFormattedMessage) defaultMessage="Daily time to check policies and run delete job:" id="admin.data_retention.createJob.instructions" /> <span className="JobSelectedtime" > <b> <Memo(MemoizedFormattedMessage) defaultMessage="{time} AM (UTC)" id="admin.data_retention.jobTimeAM" values={ Object { "time": "12:15", } } /> </b> </span> <a className="EditJobTime" onClick={[Function]} > Edit </a> </div> } disabled={false} hideJobCreateButton={true} jobType="data_retention" /> </CardBody> </Card> </div> </div> </div> `; exports[`components/admin_console/data_retention_settings/data_retention_settings should match snapshot with custom policy keep forever 1`] = ` <div className="wrapper--fixed DataRetentionSettings" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Data Retention Policies" id="admin.data_retention.settings.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Keep messages and files for a set amount of time." id="admin.data_retention.globalPolicy.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Global retention policy" id="admin.data_retention.globalPolicy.title" /> } /> </CardHeader> <CardBody expanded={true} > <div id="global_policy_table" > <DataGrid className="customTable" columns={ Array [ Object { "field": "description", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Description" id="admin.data_retention.globalPoliciesTable.description" />, }, Object { "field": "channel_messages", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Channel messages" id="admin.data_retention.globalPoliciesTable.channelMessages" />, }, Object { "field": "files", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Files" id="admin.data_retention.globalPoliciesTable.files" />, }, Object { "className": "actionIcon", "field": "actions", "name": "", }, ] } endCount={4} loading={false} nextPage={[Function]} page={0} previousPage={[Function]} rows={ Array [ Object { "cells": Object { "actions": <MenuWrapper animationComponent={[Function]} className="" isDisabled={false} stopPropagationOnToggle={true} > <div className="text-right" > <a> <i className="icon icon-dots-vertical" /> </a> </div> <Menu ariaLabel="User Actions Menu" openLeft={false} openUp={false} > <MenuItemAction buttonClass="edit_global_policy" disabled={false} onClick={[Function]} show={true} text="Edit" /> </Menu> </MenuWrapper>, "channel_messages": <div data-testid="global_message_retention_cell" > <Memo(MemoizedFormattedMessage) defaultMessage="{count} {count, plural, one {day} other {days}}" id="admin.data_retention.retention_days" values={ Object { "count": "100", } } /> </div>, "description": "Applies to all teams and channels, but does not apply to custom retention policies.", "files": <div data-testid="global_file_retention_cell" > <Memo(MemoizedFormattedMessage) defaultMessage="{count} {count, plural, one {day} other {days}}" id="admin.data_retention.retention_days" values={ Object { "count": "100", } } /> </div>, }, "onClick": [Function], }, ] } searchPlaceholder="" startCount={1} term="" total={0} /> </div> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Add policy" id="admin.data_retention.customPolicies.addPolicy" /> } onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Customize how long specific teams and channels will keep messages." id="admin.data_retention.customPolicies.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Custom retention policies" id="admin.data_retention.customPolicies.title" /> } /> </CardHeader> <CardBody expanded={true} > <div id="custom_policy_table" > <DataGrid className="customTable" columns={ Array [ Object { "field": "description", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Description" id="admin.data_retention.customPoliciesTable.description" />, }, Object { "field": "channel_messages", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Channel messages" id="admin.data_retention.customPoliciesTable.channelMessages" />, }, Object { "field": "applied_to", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Applied to" id="admin.data_retention.customPoliciesTable.appliedTo" />, }, Object { "className": "actionIcon", "field": "actions", "name": "", }, ] } endCount={1} loading={true} nextPage={[Function]} page={0} previousPage={[Function]} rows={ Array [ Object { "cells": Object { "actions": <MenuWrapper animationComponent={[Function]} className="" id="customWrapper-1234567" isDisabled={false} stopPropagationOnToggle={true} > <div className="text-right" > <a> <i className="icon icon-dots-vertical" /> </a> </div> <Menu ariaLabel="User Actions Menu" openLeft={false} openUp={false} > <MenuItemAction disabled={false} onClick={[Function]} show={true} text="Edit" /> <MenuItemAction disabled={false} onClick={[Function]} show={true} text="Delete" /> </Menu> </MenuWrapper>, "applied_to": <div id="customAppliedTo-1234567" > <Memo(MemoizedFormattedMessage) defaultMessage="{team_count} {team_count, plural, one {team} other {teams}}, {channel_count} {channel_count, plural, one {channel} other {channels}}" id="admin.data_retention.channel_team_counts" values={ Object { "channel_count": 2, "team_count": 1, } } /> </div>, "channel_messages": <div id="customDuration-1234567" > <Memo(MemoizedFormattedMessage) defaultMessage="Keep forever" id="admin.data_retention.form.keepForever" /> </div>, "description": <div id="customDescription-1234567" > Custom policy 1 </div>, }, "onClick": [Function], }, ] } searchPlaceholder="" startCount={1} term="" total={1} /> </div> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Run Deletion Job Now" id="admin.data_retention.createJob.title" /> } isDisabled={false} onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Daily log of messages and files removed based on the policies defined above." id="admin.data_retention.jobCreation.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Policy log" id="admin.data_retention.jobCreation.title" /> } /> </CardHeader> <CardBody expanded={true} > <Connect(JobTable) className="job-table__data-retention" createJobButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Run Deletion Job Now" id="admin.data_retention.createJob.title" /> } createJobHelpText={ <div> <Memo(MemoizedFormattedMessage) defaultMessage="Daily time to check policies and run delete job:" id="admin.data_retention.createJob.instructions" /> <span className="JobSelectedtime" > <b> <Memo(MemoizedFormattedMessage) defaultMessage="{time} AM (UTC)" id="admin.data_retention.jobTimeAM" values={ Object { "time": "12:15", } } /> </b> </span> <a className="EditJobTime" onClick={[Function]} > Edit </a> </div> } disabled={false} hideJobCreateButton={true} jobType="data_retention" /> </CardBody> </Card> </div> </div> </div> `; exports[`components/admin_console/data_retention_settings/data_retention_settings should match snapshot with no custom policies 1`] = ` <div className="wrapper--fixed DataRetentionSettings" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Data Retention Policies" id="admin.data_retention.settings.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Keep messages and files for a set amount of time." id="admin.data_retention.globalPolicy.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Global retention policy" id="admin.data_retention.globalPolicy.title" /> } /> </CardHeader> <CardBody expanded={true} > <div id="global_policy_table" > <DataGrid className="customTable" columns={ Array [ Object { "field": "description", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Description" id="admin.data_retention.globalPoliciesTable.description" />, }, Object { "field": "channel_messages", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Channel messages" id="admin.data_retention.globalPoliciesTable.channelMessages" />, }, Object { "field": "files", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Files" id="admin.data_retention.globalPoliciesTable.files" />, }, Object { "className": "actionIcon", "field": "actions", "name": "", }, ] } endCount={4} loading={false} nextPage={[Function]} page={0} previousPage={[Function]} rows={ Array [ Object { "cells": Object { "actions": <MenuWrapper animationComponent={[Function]} className="" isDisabled={false} stopPropagationOnToggle={true} > <div className="text-right" > <a> <i className="icon icon-dots-vertical" /> </a> </div> <Menu ariaLabel="User Actions Menu" openLeft={false} openUp={false} > <MenuItemAction buttonClass="edit_global_policy" disabled={false} onClick={[Function]} show={true} text="Edit" /> </Menu> </MenuWrapper>, "channel_messages": <div data-testid="global_message_retention_cell" > <Memo(MemoizedFormattedMessage) defaultMessage="{count} {count, plural, one {day} other {days}}" id="admin.data_retention.retention_days" values={ Object { "count": "100", } } /> </div>, "description": "Applies to all teams and channels, but does not apply to custom retention policies.", "files": <div data-testid="global_file_retention_cell" > <Memo(MemoizedFormattedMessage) defaultMessage="{count} {count, plural, one {day} other {days}}" id="admin.data_retention.retention_days" values={ Object { "count": "100", } } /> </div>, }, "onClick": [Function], }, ] } searchPlaceholder="" startCount={1} term="" total={0} /> </div> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Add policy" id="admin.data_retention.customPolicies.addPolicy" /> } onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Customize how long specific teams and channels will keep messages." id="admin.data_retention.customPolicies.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Custom retention policies" id="admin.data_retention.customPolicies.title" /> } /> </CardHeader> <CardBody expanded={true} > <div id="custom_policy_table" > <DataGrid className="customTable" columns={ Array [ Object { "field": "description", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Description" id="admin.data_retention.customPoliciesTable.description" />, }, Object { "field": "channel_messages", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Channel messages" id="admin.data_retention.customPoliciesTable.channelMessages" />, }, Object { "field": "applied_to", "name": <Memo(MemoizedFormattedMessage) defaultMessage="Applied to" id="admin.data_retention.customPoliciesTable.appliedTo" />, }, Object { "className": "actionIcon", "field": "actions", "name": "", }, ] } endCount={0} loading={true} nextPage={[Function]} page={0} previousPage={[Function]} rows={Array []} searchPlaceholder="" startCount={1} term="" total={0} /> </div> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Run Deletion Job Now" id="admin.data_retention.createJob.title" /> } isDisabled={false} onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Daily log of messages and files removed based on the policies defined above." id="admin.data_retention.jobCreation.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Policy log" id="admin.data_retention.jobCreation.title" /> } /> </CardHeader> <CardBody expanded={true} > <Connect(JobTable) className="job-table__data-retention" createJobButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Run Deletion Job Now" id="admin.data_retention.createJob.title" /> } createJobHelpText={ <div> <Memo(MemoizedFormattedMessage) defaultMessage="Daily time to check policies and run delete job:" id="admin.data_retention.createJob.instructions" /> <span className="JobSelectedtime" > <b> <Memo(MemoizedFormattedMessage) defaultMessage="{time} AM (UTC)" id="admin.data_retention.jobTimeAM" values={ Object { "time": "12:15", } } /> </b> </span> <a className="EditJobTime" onClick={[Function]} > Edit </a> </div> } disabled={false} hideJobCreateButton={true} jobType="data_retention" /> </CardBody> </Card> </div> </div> </div> `;
1,049
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/channel_list/channel_list.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import type {Channel} from '@mattermost/types/channels'; import ChannelList from 'components/admin_console/data_retention_settings/channel_list/channel_list'; import {TestHelper} from 'utils/test_helper'; describe('components/admin_console/data_retention_settings/channel_list', () => { const channel: Channel = Object.assign(TestHelper.getChannelMock({id: 'channel-1'})); test('should match snapshot', () => { const testChannels = [{ ...channel, id: '123', display_name: 'DN', team_display_name: 'teamDisplayName', team_name: 'teamName', team_update_at: 1, }]; const actions = { getDataRetentionCustomPolicyChannels: jest.fn().mockResolvedValue(testChannels), searchChannels: jest.fn(), setChannelListSearch: jest.fn(), setChannelListFilters: jest.fn(), }; const wrapper = shallow( <ChannelList searchTerm='' filters={{}} onRemoveCallback={jest.fn()} onAddCallback={jest.fn()} channelsToRemove={{}} channelsToAdd={{}} channels={testChannels} totalCount={testChannels.length} actions={actions} />); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with paging', () => { const testChannels = []; for (let i = 0; i < 30; i++) { testChannels.push({ ...channel, id: 'id' + i, display_name: 'DN' + i, team_display_name: 'teamDisplayName', team_name: 'teamName', team_update_at: 1, }); } const actions = { getDataRetentionCustomPolicyChannels: jest.fn().mockResolvedValue(testChannels), searchChannels: jest.fn(), setChannelListSearch: jest.fn(), setChannelListFilters: jest.fn(), }; const wrapper = shallow( <ChannelList searchTerm='' filters={{}} onRemoveCallback={jest.fn()} onAddCallback={jest.fn()} channelsToRemove={{}} channelsToAdd={{}} channels={testChannels} totalCount={30} actions={actions} />); wrapper.setState({loading: false}); expect(wrapper).toMatchSnapshot(); }); });
1,052
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/channel_list
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/channel_list/__snapshots__/channel_list.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/data_retention_settings/channel_list should match snapshot 1`] = ` <div className="PolicyChannelsList" > <DataGrid className="customTable" columns={ Array [ Object { "field": "name", "fixed": true, "name": <Memo(MemoizedFormattedMessage) defaultMessage="Name" id="admin.channel_settings.channel_list.nameHeader" />, }, Object { "field": "team", "fixed": true, "name": <Memo(MemoizedFormattedMessage) defaultMessage="Team" id="admin.channel_settings.channel_list.teamHeader" />, }, Object { "field": "remove", "fixed": true, "name": "", "textAlign": "right", }, ] } endCount={1} filterProps={ Object { "keys": Array [ "teams", "channels", ], "onFilter": [Function], "options": Object { "channels": Object { "keys": Array [ "public", "private", "deleted", ], "name": "Channels", "values": Object { "deleted": Object { "name": <Memo(MemoizedFormattedMessage) defaultMessage="Archived" id="admin.channel_list.archived" />, "value": false, }, "private": Object { "name": <Memo(MemoizedFormattedMessage) defaultMessage="Private" id="admin.channel_list.private" />, "value": false, }, "public": Object { "name": <Memo(MemoizedFormattedMessage) defaultMessage="Public" id="admin.channel_list.public" />, "value": false, }, }, }, "teams": Object { "keys": Array [ "team_ids", ], "name": "Teams", "type": Object { "$$typeof": Symbol(react.memo), "WrappedComponent": [Function], "compare": null, "type": [Function], }, "values": Object { "team_ids": Object { "name": <Memo(MemoizedFormattedMessage) defaultMessage="Teams" id="admin.team_settings.title" />, "value": Array [], }, }, }, }, } } loading={false} nextPage={[Function]} onSearch={[Function]} page={0} previousPage={[Function]} rows={ Array [ Object { "cells": Object { "id": "123", "name": <div className="ChannelList__nameColumn" id="channel-name-123" > <GlobeIcon className="channel-icon" /> <div className="ChannelList__nameText" > <b id="display-name-channel-123" > DN </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-channel-123" onClick={[Function]} > <Memo(MemoizedFormattedMessage) defaultMessage="Remove" id="admin.data_retention.custom_policy.teams.remove" /> </a>, "team": "teamDisplayName", }, }, ] } searchPlaceholder="" startCount={1} term="" total={1} /> </div> `; exports[`components/admin_console/data_retention_settings/channel_list should match snapshot with paging 1`] = ` <div className="PolicyChannelsList" > <DataGrid className="customTable" columns={ Array [ Object { "field": "name", "fixed": true, "name": <Memo(MemoizedFormattedMessage) defaultMessage="Name" id="admin.channel_settings.channel_list.nameHeader" />, }, Object { "field": "team", "fixed": true, "name": <Memo(MemoizedFormattedMessage) defaultMessage="Team" id="admin.channel_settings.channel_list.teamHeader" />, }, Object { "field": "remove", "fixed": true, "name": "", "textAlign": "right", }, ] } endCount={10} filterProps={ Object { "keys": Array [ "teams", "channels", ], "onFilter": [Function], "options": Object { "channels": Object { "keys": Array [ "public", "private", "deleted", ], "name": "Channels", "values": Object { "deleted": Object { "name": <Memo(MemoizedFormattedMessage) defaultMessage="Archived" id="admin.channel_list.archived" />, "value": false, }, "private": Object { "name": <Memo(MemoizedFormattedMessage) defaultMessage="Private" id="admin.channel_list.private" />, "value": false, }, "public": Object { "name": <Memo(MemoizedFormattedMessage) defaultMessage="Public" id="admin.channel_list.public" />, "value": false, }, }, }, "teams": Object { "keys": Array [ "team_ids", ], "name": "Teams", "type": Object { "$$typeof": Symbol(react.memo), "WrappedComponent": [Function], "compare": null, "type": [Function], }, "values": Object { "team_ids": Object { "name": <Memo(MemoizedFormattedMessage) defaultMessage="Teams" id="admin.team_settings.title" />, "value": Array [], }, }, }, }, } } loading={false} nextPage={[Function]} onSearch={[Function]} page={0} previousPage={[Function]} rows={ Array [ Object { "cells": Object { "id": "id0", "name": <div className="ChannelList__nameColumn" id="channel-name-id0" > <GlobeIcon className="channel-icon" /> <div className="ChannelList__nameText" > <b id="display-name-channel-id0" > DN0 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-channel-id0" onClick={[Function]} > <Memo(MemoizedFormattedMessage) defaultMessage="Remove" id="admin.data_retention.custom_policy.teams.remove" /> </a>, "team": "teamDisplayName", }, }, Object { "cells": Object { "id": "id1", "name": <div className="ChannelList__nameColumn" id="channel-name-id1" > <GlobeIcon className="channel-icon" /> <div className="ChannelList__nameText" > <b id="display-name-channel-id1" > DN1 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-channel-id1" onClick={[Function]} > <Memo(MemoizedFormattedMessage) defaultMessage="Remove" id="admin.data_retention.custom_policy.teams.remove" /> </a>, "team": "teamDisplayName", }, }, Object { "cells": Object { "id": "id2", "name": <div className="ChannelList__nameColumn" id="channel-name-id2" > <GlobeIcon className="channel-icon" /> <div className="ChannelList__nameText" > <b id="display-name-channel-id2" > DN2 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-channel-id2" onClick={[Function]} > <Memo(MemoizedFormattedMessage) defaultMessage="Remove" id="admin.data_retention.custom_policy.teams.remove" /> </a>, "team": "teamDisplayName", }, }, Object { "cells": Object { "id": "id3", "name": <div className="ChannelList__nameColumn" id="channel-name-id3" > <GlobeIcon className="channel-icon" /> <div className="ChannelList__nameText" > <b id="display-name-channel-id3" > DN3 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-channel-id3" onClick={[Function]} > <Memo(MemoizedFormattedMessage) defaultMessage="Remove" id="admin.data_retention.custom_policy.teams.remove" /> </a>, "team": "teamDisplayName", }, }, Object { "cells": Object { "id": "id4", "name": <div className="ChannelList__nameColumn" id="channel-name-id4" > <GlobeIcon className="channel-icon" /> <div className="ChannelList__nameText" > <b id="display-name-channel-id4" > DN4 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-channel-id4" onClick={[Function]} > <Memo(MemoizedFormattedMessage) defaultMessage="Remove" id="admin.data_retention.custom_policy.teams.remove" /> </a>, "team": "teamDisplayName", }, }, Object { "cells": Object { "id": "id5", "name": <div className="ChannelList__nameColumn" id="channel-name-id5" > <GlobeIcon className="channel-icon" /> <div className="ChannelList__nameText" > <b id="display-name-channel-id5" > DN5 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-channel-id5" onClick={[Function]} > <Memo(MemoizedFormattedMessage) defaultMessage="Remove" id="admin.data_retention.custom_policy.teams.remove" /> </a>, "team": "teamDisplayName", }, }, Object { "cells": Object { "id": "id6", "name": <div className="ChannelList__nameColumn" id="channel-name-id6" > <GlobeIcon className="channel-icon" /> <div className="ChannelList__nameText" > <b id="display-name-channel-id6" > DN6 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-channel-id6" onClick={[Function]} > <Memo(MemoizedFormattedMessage) defaultMessage="Remove" id="admin.data_retention.custom_policy.teams.remove" /> </a>, "team": "teamDisplayName", }, }, Object { "cells": Object { "id": "id7", "name": <div className="ChannelList__nameColumn" id="channel-name-id7" > <GlobeIcon className="channel-icon" /> <div className="ChannelList__nameText" > <b id="display-name-channel-id7" > DN7 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-channel-id7" onClick={[Function]} > <Memo(MemoizedFormattedMessage) defaultMessage="Remove" id="admin.data_retention.custom_policy.teams.remove" /> </a>, "team": "teamDisplayName", }, }, Object { "cells": Object { "id": "id8", "name": <div className="ChannelList__nameColumn" id="channel-name-id8" > <GlobeIcon className="channel-icon" /> <div className="ChannelList__nameText" > <b id="display-name-channel-id8" > DN8 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-channel-id8" onClick={[Function]} > <Memo(MemoizedFormattedMessage) defaultMessage="Remove" id="admin.data_retention.custom_policy.teams.remove" /> </a>, "team": "teamDisplayName", }, }, Object { "cells": Object { "id": "id9", "name": <div className="ChannelList__nameColumn" id="channel-name-id9" > <GlobeIcon className="channel-icon" /> <div className="ChannelList__nameText" > <b id="display-name-channel-id9" > DN9 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-channel-id9" onClick={[Function]} > <Memo(MemoizedFormattedMessage) defaultMessage="Remove" id="admin.data_retention.custom_policy.teams.remove" /> </a>, "team": "teamDisplayName", }, }, ] } searchPlaceholder="" startCount={1} term="" total={30} /> </div> `;
1,054
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/custom_policy_form/custom_policy_form.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import CustomPolicyForm from 'components/admin_console/data_retention_settings/custom_policy_form/custom_policy_form'; describe('components/admin_console/data_retention_settings/custom_policy_form', () => { const defaultProps = { actions: { setNavigationBlocked: jest.fn(), fetchPolicy: jest.fn().mockResolvedValue([]), fetchPolicyTeams: jest.fn().mockResolvedValue([]), createDataRetentionCustomPolicy: jest.fn(), updateDataRetentionCustomPolicy: jest.fn(), addDataRetentionCustomPolicyTeams: jest.fn(), removeDataRetentionCustomPolicyTeams: jest.fn(), addDataRetentionCustomPolicyChannels: jest.fn(), removeDataRetentionCustomPolicyChannels: jest.fn(), }, }; test('should match snapshot with creating new policy', () => { const props = {...defaultProps}; const wrapper = shallow(<CustomPolicyForm {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with editing existing policy', () => { const props = {...defaultProps}; const wrapper = shallow( <CustomPolicyForm {...props} policyId='fsdgdsgdsgh' policy={{ id: 'fsdgdsgdsgh', display_name: 'Test Policy', post_duration: 22, team_count: 1, channel_count: 2, }} />, ); expect(wrapper).toMatchSnapshot(); }); });
1,057
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/custom_policy_form
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/custom_policy_form/__snapshots__/custom_policy_form.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/data_retention_settings/custom_policy_form should match snapshot with creating new policy 1`] = ` <div className="wrapper--fixed DataRetentionSettings" > <AdminHeader withBackButton={true} > <div> <Connect(Component) className="fa fa-angle-left back" to="/admin_console/compliance/data_retention_settings" /> <MemoizedFormattedMessage defaultMessage="Custom Retention Policy" id="admin.data_retention.customTitle" /> </div> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Give your policy a name and configure retention settings." id="admin.data_retention.custom_policy.form.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Name and retention" id="admin.data_retention.custom_policy.form.title" /> } /> </CardHeader> <CardBody expanded={true} > <div className="CustomPolicy__fields" > <ForwardRef aria-label="Policy name" customMessage={ Object { "type": "error", "value": "", } } name="policyName" onChange={[Function]} placeholder="Policy name" type="text" value="" /> <DropdownInputHybrid defaultValue={ Object { "label": <div> <i className="icon icon-infinity option-icon" /> <span className="option_forever" > Keep forever </span> </div>, "value": "FOREVER", } } dropdownClassNamePrefix="message_retention" exceptionToInput={ Array [ "FOREVER", ] } inputId="message_retention_input" inputType="number" inputValue="" legend="Channel & direct message retention" name="message_retention" onDropdownChange={[Function]} onInputChange={[Function]} options={ Array [ Object { "label": <span className="option_days" > Days </span>, "value": "DAYS", }, Object { "label": <span className="option_years" > Years </span>, "value": "YEARS", }, Object { "label": <div> <i className="icon icon-infinity option-icon" /> <span className="option_forever" > Keep forever </span> </div>, "value": "FOREVER", }, ] } placeholder="Channel & direct message retention" value={ Object { "label": <div> <i className="icon icon-infinity option-icon" /> <span className="option_forever" > Keep forever </span> </div>, "value": "FOREVER", } } width={95} /> </div> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Add teams" id="admin.data_retention.custom_policy.team_selector.addTeams" /> } onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Add teams that will follow this retention policy." id="admin.data_retention.custom_policy.team_selector.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Assigned teams" id="admin.data_retention.custom_policy.team_selector.title" /> } /> </CardHeader> <CardBody expanded={true} > <Connect(TeamList) onAddCallback={[Function]} onRemoveCallback={[Function]} teamsToAdd={Object {}} teamsToRemove={Object {}} /> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Add channels" id="admin.data_retention.custom_policy.channel_selector.addChannels" /> } onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Add channels that will follow this retention policy." id="admin.data_retention.custom_policy.channel_selector.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Assigned channels" id="admin.data_retention.custom_policy.channel_selector.title" /> } /> </CardHeader> <CardBody expanded={true} > <Connect(ChannelList) channelsToAdd={Object {}} channelsToRemove={Object {}} onAddCallback={[Function]} onRemoveCallback={[Function]} /> </CardBody> </Card> </div> </div> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="admin.data_retention.custom_policy.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Saving" id="save_button.saving" /> } /> <Connect(Component) className="cancel-button" to="/admin_console/compliance/data_retention_settings" > <MemoizedFormattedMessage defaultMessage="Cancel" id="admin.data_retention.custom_policy.cancel" /> </Connect(Component)> </div> </div> `; exports[`components/admin_console/data_retention_settings/custom_policy_form should match snapshot with editing existing policy 1`] = ` <div className="wrapper--fixed DataRetentionSettings" > <AdminHeader withBackButton={true} > <div> <Connect(Component) className="fa fa-angle-left back" to="/admin_console/compliance/data_retention_settings" /> <MemoizedFormattedMessage defaultMessage="Custom Retention Policy" id="admin.data_retention.customTitle" /> </div> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Give your policy a name and configure retention settings." id="admin.data_retention.custom_policy.form.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Name and retention" id="admin.data_retention.custom_policy.form.title" /> } /> </CardHeader> <CardBody expanded={true} > <div className="CustomPolicy__fields" > <ForwardRef aria-label="Policy name" customMessage={ Object { "type": "error", "value": "", } } name="policyName" onChange={[Function]} placeholder="Policy name" type="text" value="" /> <DropdownInputHybrid defaultValue={ Object { "label": <div> <i className="icon icon-infinity option-icon" /> <span className="option_forever" > Keep forever </span> </div>, "value": "FOREVER", } } dropdownClassNamePrefix="message_retention" exceptionToInput={ Array [ "FOREVER", ] } inputId="message_retention_input" inputType="number" inputValue="22" legend="Channel & direct message retention" name="message_retention" onDropdownChange={[Function]} onInputChange={[Function]} options={ Array [ Object { "label": <span className="option_days" > Days </span>, "value": "DAYS", }, Object { "label": <span className="option_years" > Years </span>, "value": "YEARS", }, Object { "label": <div> <i className="icon icon-infinity option-icon" /> <span className="option_forever" > Keep forever </span> </div>, "value": "FOREVER", }, ] } placeholder="Channel & direct message retention" value={ Object { "label": <span className="option_days" > Days </span>, "value": "DAYS", } } width={95} /> </div> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Add teams" id="admin.data_retention.custom_policy.team_selector.addTeams" /> } onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Add teams that will follow this retention policy." id="admin.data_retention.custom_policy.team_selector.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Assigned teams" id="admin.data_retention.custom_policy.team_selector.title" /> } /> </CardHeader> <CardBody expanded={true} > <Connect(TeamList) onAddCallback={[Function]} onRemoveCallback={[Function]} policyId="fsdgdsgdsgh" teamsToAdd={Object {}} teamsToRemove={Object {}} /> </CardBody> </Card> <Card className="console" expanded={true} > <CardHeader> <TitleAndButtonCardHeader buttonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Add channels" id="admin.data_retention.custom_policy.channel_selector.addChannels" /> } onClick={[Function]} subtitle={ <Memo(MemoizedFormattedMessage) defaultMessage="Add channels that will follow this retention policy." id="admin.data_retention.custom_policy.channel_selector.subTitle" /> } title={ <Memo(MemoizedFormattedMessage) defaultMessage="Assigned channels" id="admin.data_retention.custom_policy.channel_selector.title" /> } /> </CardHeader> <CardBody expanded={true} > <Connect(ChannelList) channelsToAdd={Object {}} channelsToRemove={Object {}} onAddCallback={[Function]} onRemoveCallback={[Function]} policyId="fsdgdsgdsgh" /> </CardBody> </Card> </div> </div> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="admin.data_retention.custom_policy.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Saving" id="save_button.saving" /> } /> <Connect(Component) className="cancel-button" to="/admin_console/compliance/data_retention_settings" > <MemoizedFormattedMessage defaultMessage="Cancel" id="admin.data_retention.custom_policy.cancel" /> </Connect(Component)> </div> </div> `;
1,060
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/global_policy_form/global_policy_form.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import GlobalPolicyForm from 'components/admin_console/data_retention_settings/global_policy_form/global_policy_form'; describe('components/PluginManagement', () => { const defaultProps = { config: { DataRetentionSettings: { EnableMessageDeletion: true, EnableFileDeletion: true, MessageRetentionDays: 60, FileRetentionDays: 40, DeletionJobStartTime: '10:00', }, }, actions: { updateConfig: jest.fn(), setNavigationBlocked: jest.fn(), }, }; test('should match snapshot', () => { const props = {...defaultProps}; const wrapper = shallow(<GlobalPolicyForm {...props}/>); expect(wrapper).toMatchSnapshot(); }); });
1,063
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/global_policy_form
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/global_policy_form/__snapshots__/global_policy_form.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/PluginManagement should match snapshot 1`] = ` <div className="wrapper--fixed DataRetentionSettings" > <AdminHeader withBackButton={true} > <div> <Connect(Component) className="fa fa-angle-left back" to="/admin_console/compliance/data_retention_settings" /> <MemoizedFormattedMessage defaultMessage="Global Retention Policy" id="admin.data_retention.globalPolicyTitle" /> </div> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <Card className="console" expanded={true} > <CardBody> <div className="global_policy" > <p> Applies to all teams and channels, but does not apply to custom retention policies. </p> <div id="global_direct_message_dropdown" > <DropdownInputHybrid defaultValue={ Object { "label": <div> <i className="icon icon-infinity option-icon" /> <span className="option_forever" > Keep forever </span> </div>, "value": "FOREVER", } } dropdownClassNamePrefix="channel_message_retention_dropdown" exceptionToInput={ Array [ "FOREVER", ] } inputId="channel_message_retention_input" inputType="number" inputValue="60" legend="Channel & direct message retention" name="channel_message_retention" onDropdownChange={[Function]} onInputChange={[Function]} options={ Array [ Object { "label": <span className="option_days" > Days </span>, "value": "DAYS", }, Object { "label": <span className="option_years" > Years </span>, "value": "YEARS", }, Object { "label": <div> <i className="icon icon-infinity option-icon" /> <span className="option_forever" > Keep forever </span> </div>, "value": "FOREVER", }, ] } placeholder="Channel & direct message retention" value={ Object { "label": <span className="option_days" > Days </span>, "value": "DAYS", } } width={90} /> </div> <div id="global_file_dropdown" > <DropdownInputHybrid defaultValue={ Object { "label": <div> <i className="icon icon-infinity option-icon" /> <span className="option_forever" > Keep forever </span> </div>, "value": "FOREVER", } } dropdownClassNamePrefix="file_retention_dropdown" exceptionToInput={ Array [ "FOREVER", ] } inputId="file_retention_input" inputType="number" inputValue="40" legend="File retention" name="file_retention" onDropdownChange={[Function]} onInputChange={[Function]} options={ Array [ Object { "label": <span className="option_days" > Days </span>, "value": "DAYS", }, Object { "label": <span className="option_years" > Years </span>, "value": "YEARS", }, Object { "label": <div> <i className="icon icon-infinity option-icon" /> <span className="option_forever" > Keep forever </span> </div>, "value": "FOREVER", }, ] } placeholder="File retention" value={ Object { "label": <span className="option_days" > Days </span>, "value": "DAYS", } } width={90} /> </div> </div> </CardBody> </Card> </div> </div> <div className="admin-console-save" > <SaveButton btnClass="" defaultMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Save" id="admin.data_retention.custom_policy.save" /> } disabled={true} extraClasses="" onClick={[Function]} saving={false} savingMessage={ <Memo(MemoizedFormattedMessage) defaultMessage="Saving" id="save_button.saving" /> } /> <Connect(Component) className="cancel-button" to="/admin_console/compliance/data_retention_settings" > <MemoizedFormattedMessage defaultMessage="Cancel" id="admin.data_retention.custom_policy.cancel" /> </Connect(Component)> </div> </div> `;
1,066
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/team_list/team_list.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import type {Team} from '@mattermost/types/teams'; import TeamList from 'components/admin_console/data_retention_settings/team_list/team_list'; import {TestHelper} from 'utils/test_helper'; describe('components/admin_console/data_retention_settings/team_list', () => { const team: Team = Object.assign(TestHelper.getTeamMock({id: 'team-1'})); test('should match snapshot', () => { const testTeams = [{ ...team, }]; const actions = { getDataRetentionCustomPolicyTeams: jest.fn().mockResolvedValue(testTeams), searchTeams: jest.fn(), setTeamListSearch: jest.fn(), setTeamListFilters: jest.fn(), }; const wrapper = shallow( <TeamList searchTerm='' onRemoveCallback={jest.fn()} onAddCallback={jest.fn()} teamsToRemove={{}} teamsToAdd={{}} teams={testTeams} totalCount={testTeams.length} actions={actions} />); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with paging', () => { const testTeams = []; for (let i = 0; i < 30; i++) { testTeams.push({ ...team, id: 'id' + i, display_name: 'DN' + i, }); } const actions = { getDataRetentionCustomPolicyTeams: jest.fn().mockResolvedValue(testTeams), searchTeams: jest.fn(), setTeamListSearch: jest.fn(), setTeamListFilters: jest.fn(), }; const wrapper = shallow( <TeamList searchTerm='' onRemoveCallback={jest.fn()} onAddCallback={jest.fn()} teamsToRemove={{}} teamsToAdd={{}} teams={testTeams} totalCount={testTeams.length} actions={actions} />); wrapper.setState({loading: false}); expect(wrapper).toMatchSnapshot(); }); });
1,068
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/team_list
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/data_retention_settings/team_list/__snapshots__/team_list.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/data_retention_settings/team_list should match snapshot 1`] = ` <div className="PolicyTeamsList" > <DataGrid className="customTable" columns={ Array [ Object { "field": "name", "fixed": true, "name": <Memo(MemoizedFormattedMessage) defaultMessage="Name" id="admin.team_settings.team_list.nameHeader" />, }, Object { "className": "TeamList__actionColumn", "field": "remove", "fixed": true, "name": "", "textAlign": "right", }, ] } endCount={1} loading={false} nextPage={[Function]} onSearch={[Function]} page={0} previousPage={[Function]} rows={ Array [ Object { "cells": Object { "id": "team-1", "name": <div className="TeamList__nameColumn" id="team-name-team-1" > <div className="TeamList__lowerOpacity" > <injectIntl(TeamIcon) content="name" size="sm" url={null} /> </div> <div className="TeamList__nameText" > <b data-testid="team-display-name" > name </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-team-team-1" onClick={[Function]} > Remove </a>, }, }, ] } searchPlaceholder="" startCount={1} term="" total={1} /> </div> `; exports[`components/admin_console/data_retention_settings/team_list should match snapshot with paging 1`] = ` <div className="PolicyTeamsList" > <DataGrid className="customTable" columns={ Array [ Object { "field": "name", "fixed": true, "name": <Memo(MemoizedFormattedMessage) defaultMessage="Name" id="admin.team_settings.team_list.nameHeader" />, }, Object { "className": "TeamList__actionColumn", "field": "remove", "fixed": true, "name": "", "textAlign": "right", }, ] } endCount={10} loading={false} nextPage={[Function]} onSearch={[Function]} page={0} previousPage={[Function]} rows={ Array [ Object { "cells": Object { "id": "id0", "name": <div className="TeamList__nameColumn" id="team-name-id0" > <div className="TeamList__lowerOpacity" > <injectIntl(TeamIcon) content="DN0" size="sm" url={null} /> </div> <div className="TeamList__nameText" > <b data-testid="team-display-name" > DN0 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-team-id0" onClick={[Function]} > Remove </a>, }, }, Object { "cells": Object { "id": "id1", "name": <div className="TeamList__nameColumn" id="team-name-id1" > <div className="TeamList__lowerOpacity" > <injectIntl(TeamIcon) content="DN1" size="sm" url={null} /> </div> <div className="TeamList__nameText" > <b data-testid="team-display-name" > DN1 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-team-id1" onClick={[Function]} > Remove </a>, }, }, Object { "cells": Object { "id": "id2", "name": <div className="TeamList__nameColumn" id="team-name-id2" > <div className="TeamList__lowerOpacity" > <injectIntl(TeamIcon) content="DN2" size="sm" url={null} /> </div> <div className="TeamList__nameText" > <b data-testid="team-display-name" > DN2 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-team-id2" onClick={[Function]} > Remove </a>, }, }, Object { "cells": Object { "id": "id3", "name": <div className="TeamList__nameColumn" id="team-name-id3" > <div className="TeamList__lowerOpacity" > <injectIntl(TeamIcon) content="DN3" size="sm" url={null} /> </div> <div className="TeamList__nameText" > <b data-testid="team-display-name" > DN3 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-team-id3" onClick={[Function]} > Remove </a>, }, }, Object { "cells": Object { "id": "id4", "name": <div className="TeamList__nameColumn" id="team-name-id4" > <div className="TeamList__lowerOpacity" > <injectIntl(TeamIcon) content="DN4" size="sm" url={null} /> </div> <div className="TeamList__nameText" > <b data-testid="team-display-name" > DN4 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-team-id4" onClick={[Function]} > Remove </a>, }, }, Object { "cells": Object { "id": "id5", "name": <div className="TeamList__nameColumn" id="team-name-id5" > <div className="TeamList__lowerOpacity" > <injectIntl(TeamIcon) content="DN5" size="sm" url={null} /> </div> <div className="TeamList__nameText" > <b data-testid="team-display-name" > DN5 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-team-id5" onClick={[Function]} > Remove </a>, }, }, Object { "cells": Object { "id": "id6", "name": <div className="TeamList__nameColumn" id="team-name-id6" > <div className="TeamList__lowerOpacity" > <injectIntl(TeamIcon) content="DN6" size="sm" url={null} /> </div> <div className="TeamList__nameText" > <b data-testid="team-display-name" > DN6 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-team-id6" onClick={[Function]} > Remove </a>, }, }, Object { "cells": Object { "id": "id7", "name": <div className="TeamList__nameColumn" id="team-name-id7" > <div className="TeamList__lowerOpacity" > <injectIntl(TeamIcon) content="DN7" size="sm" url={null} /> </div> <div className="TeamList__nameText" > <b data-testid="team-display-name" > DN7 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-team-id7" onClick={[Function]} > Remove </a>, }, }, Object { "cells": Object { "id": "id8", "name": <div className="TeamList__nameColumn" id="team-name-id8" > <div className="TeamList__lowerOpacity" > <injectIntl(TeamIcon) content="DN8" size="sm" url={null} /> </div> <div className="TeamList__nameText" > <b data-testid="team-display-name" > DN8 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-team-id8" onClick={[Function]} > Remove </a>, }, }, Object { "cells": Object { "id": "id9", "name": <div className="TeamList__nameColumn" id="team-name-id9" > <div className="TeamList__lowerOpacity" > <injectIntl(TeamIcon) content="DN9" size="sm" url={null} /> </div> <div className="TeamList__nameText" > <b data-testid="team-display-name" > DN9 </b> </div> </div>, "remove": <a className="group-actions TeamList_editText" href="#" id="remove-team-id9" onClick={[Function]} > Remove </a>, }, }, ] } searchPlaceholder="" startCount={1} term="" total={30} /> </div> `;
1,073
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import FeatureDiscovery from 'components/admin_console/feature_discovery/feature_discovery'; import { renderWithContext, screen, userEvent, waitFor, } from 'tests/react_testing_utils'; import {AboutLinks, LicenseSkus} from 'utils/constants'; import SamlSVG from './features/images/saml_svg'; describe('components/feature_discovery', () => { describe('FeatureDiscovery', () => { test('should match the default state of the component when is not cloud environment', async () => { const getPrevTrialLicense = jest.fn(); const getCloudSubscription = jest.fn(); const openModal = jest.fn(); renderWithContext( <FeatureDiscovery featureName='test' minimumSKURequiredForFeature={LicenseSkus.Professional} titleID='translation.test.title' titleDefault='Foo' copyID='translation.test.copy' copyDefault={'Bar'} learnMoreURL='https://test.mattermost.com/secondary/' featureDiscoveryImage={<SamlSVG/>} // eslint-disable-next-line @typescript-eslint/naming-convention stats={{TOTAL_USERS: 20}} prevTrialLicense={{IsLicensed: 'false'}} isCloud={false} isCloudTrial={false} hadPrevCloudTrial={false} isSubscriptionLoaded={true} isPaidSubscription={false} cloudFreeDeprecated={false} actions={{ getPrevTrialLicense, getCloudSubscription, openModal, }} />, ); expect(screen.queryByText('Bar')).toBeInTheDocument(); expect(screen.queryByText('Foo')).toBeInTheDocument(); expect(screen.getByRole('button', {name: 'Start trial'})).toBeInTheDocument(); await userEvent.click(screen.getByRole('button', {name: 'Start trial'})); await userEvent.click(screen.getByText('Mattermost Software and Services License Agreement')); //cloud option expect(screen.queryByRole('button', {name: 'Try free for 30 days'})).not.toBeInTheDocument(); const featureLink = screen.getByTestId('featureDiscovery_secondaryCallToAction'); expect(featureLink).toBeInTheDocument(); expect(featureLink).toHaveAttribute('href', 'https://test.mattermost.com/secondary/?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); expect(featureLink).toHaveTextContent('Learn more'); expect(screen.getByText('Mattermost Software and Services License Agreement')).toHaveAttribute('href', 'https://mattermost.com/pl/software-and-services-license-agreement?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); expect(screen.getByText('Privacy Policy')).toHaveAttribute('href', AboutLinks.PRIVACY_POLICY + '?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); expect(getPrevTrialLicense).toHaveBeenCalled(); expect(getCloudSubscription).not.toHaveBeenCalled(); expect(openModal).not.toHaveBeenCalled(); }); test('should match component state when is cloud environment', async () => { const getPrevTrialLicense = jest.fn(); const getCloudSubscription = jest.fn(); const openModal = jest.fn(); await waitFor(() => { renderWithContext( <FeatureDiscovery featureName='test' minimumSKURequiredForFeature={LicenseSkus.Professional} titleID='translation.test.title' titleDefault='Foo' copyID='translation.test.copy' copyDefault={'Bar'} learnMoreURL='https://test.mattermost.com/secondary/' featureDiscoveryImage={<SamlSVG/>} // eslint-disable-next-line @typescript-eslint/naming-convention stats={{TOTAL_USERS: 20}} prevTrialLicense={{IsLicensed: 'false'}} isCloud={true} isCloudTrial={false} hadPrevCloudTrial={false} isPaidSubscription={false} isSubscriptionLoaded={true} cloudFreeDeprecated={false} actions={{ getPrevTrialLicense, getCloudSubscription, openModal, }} />, ); }); // subscription is loaded, so loadingSpinner should not be visible expect(screen.queryByTestId('loadingSpinner')).not.toBeInTheDocument(); expect(screen.queryByText('Bar')).toBeInTheDocument(); expect(screen.queryByText('Foo')).toBeInTheDocument(); //this option is visible only when it is cloud environment expect(screen.getByRole('button', {name: 'Try free for 30 days'})).toBeInTheDocument(); expect(screen.getAllByText('Try free for 30 days')).toHaveLength(2); expect(screen.getByTestId('featureDiscovery_secondaryCallToAction')).toHaveAttribute('href', 'https://test.mattermost.com/secondary/?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); expect(screen.getByText('Privacy Policy')).toHaveAttribute('href', 'https://mattermost.com/pl/privacy-policy/?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); const featureLink = screen.getByTestId('featureDiscovery_secondaryCallToAction'); expect(featureLink).toBeInTheDocument(); expect(featureLink).toHaveAttribute('href', 'https://test.mattermost.com/secondary/?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); expect(featureLink).toHaveTextContent('Learn more'); expect(getPrevTrialLicense).toHaveBeenCalled(); expect(getCloudSubscription).not.toHaveBeenCalled(); expect(openModal).not.toHaveBeenCalled(); expect(screen.queryByRole('button', {name: 'Start trial'})).not.toBeInTheDocument(); }); test('should match component state when is cloud environment and subscription is not loaded yet in redux store', () => { const getPrevTrialLicense = jest.fn(); const getCloudSubscription = jest.fn(); const openModal = jest.fn(); renderWithContext( <FeatureDiscovery featureName='test' minimumSKURequiredForFeature={LicenseSkus.Professional} titleID='translation.test.title' titleDefault='Foo' copyID='translation.test.copy' copyDefault={'Bar'} learnMoreURL='https://test.mattermost.com/secondary/' featureDiscoveryImage={<SamlSVG/>} // eslint-disable-next-line @typescript-eslint/naming-convention stats={{TOTAL_USERS: 20}} prevTrialLicense={{IsLicensed: 'false'}} isCloud={true} isCloudTrial={false} hadPrevCloudTrial={false} isSubscriptionLoaded={false} isPaidSubscription={false} cloudFreeDeprecated={false} actions={{ getPrevTrialLicense, getCloudSubscription, openModal, }} />, ); // when is cloud and subscription is not loaded yet, then only loading spinner is visible expect(screen.getByTestId('loadingSpinner')).toBeInTheDocument(); expect(screen.queryByText('Bar')).not.toBeInTheDocument(); expect(screen.queryByText('Foo')).not.toBeInTheDocument(); //this option is visible only when subscription is loaded and is cloud environment expect(screen.queryByRole('button', {name: 'Try free for 30 days'})).not.toBeInTheDocument(); expect(screen.queryByTestId('featureDiscovery_secondaryCallToAction')).not.toBeInTheDocument(); expect(getPrevTrialLicense).toHaveBeenCalled(); expect(getCloudSubscription).not.toHaveBeenCalled(); expect(openModal).not.toHaveBeenCalled(); expect(screen.queryByRole('button', {name: 'Start trial'})).not.toBeInTheDocument(); }); }); });
1,107
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_row.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import GroupRow from 'components/admin_console/group_settings/group_row'; import LoadingSpinner from 'components/widgets/loading/loading_spinner'; describe('components/admin_console/group_settings/GroupRow', () => { test('should match snapshot, on linked and configured row', () => { const wrapper = shallow( <GroupRow primary_key='primary_key' name='name' mattermost_group_id='group-id' has_syncables={true} checked={false} failed={false} onCheckToggle={jest.fn()} actions={{ link: jest.fn(), unlink: jest.fn(), }} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, on linked but not configured row', () => { const wrapper = shallow( <GroupRow primary_key='primary_key' name='name' mattermost_group_id='group-id' has_syncables={false} checked={false} failed={false} onCheckToggle={jest.fn()} actions={{ link: jest.fn(), unlink: jest.fn(), }} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, on not linked row', () => { const wrapper = shallow( <GroupRow primary_key='primary_key' name='name' mattermost_group_id={undefined} has_syncables={undefined} checked={false} failed={false} onCheckToggle={jest.fn()} actions={{ link: jest.fn(), unlink: jest.fn(), }} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, on checked row', () => { const wrapper = shallow( <GroupRow primary_key='primary_key' name='name' mattermost_group_id={undefined} has_syncables={undefined} checked={true} failed={false} onCheckToggle={jest.fn()} actions={{ link: jest.fn(), unlink: jest.fn(), }} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, on failed linked row', () => { const wrapper = shallow( <GroupRow primary_key='primary_key' name='name' mattermost_group_id='group-id' has_syncables={undefined} checked={false} failed={true} onCheckToggle={jest.fn()} actions={{ link: jest.fn(), unlink: jest.fn(), }} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, on failed not linked row', () => { const wrapper = shallow( <GroupRow primary_key='primary_key' name='name' mattermost_group_id={undefined} has_syncables={undefined} checked={false} failed={true} onCheckToggle={jest.fn()} actions={{ link: jest.fn(), unlink: jest.fn(), }} />, ); expect(wrapper).toMatchSnapshot(); }); test('onRowClick call to onCheckToggle', () => { const onCheckToggle = jest.fn(); const wrapper = shallow( <GroupRow primary_key='primary_key' name='name' mattermost_group_id={undefined} has_syncables={undefined} checked={false} failed={false} onCheckToggle={onCheckToggle} actions={{ link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.find('.group').prop('onClick')?.({} as unknown as React.MouseEvent); expect(onCheckToggle).toHaveBeenCalledWith('primary_key'); }); test('linkHandler must run the link action', async () => { const link = jest.fn().mockReturnValue(Promise.resolve()); const wrapper = shallow( <GroupRow primary_key='primary_key' name='name' mattermost_group_id={undefined} has_syncables={undefined} checked={false} failed={false} onCheckToggle={jest.fn()} actions={{ link, unlink: jest.fn(), }} />, ); await wrapper.find('a').prop('onClick')?.({stopPropagation: jest.fn(), preventDefault: jest.fn()} as unknown as React.MouseEvent); expect(wrapper.find(LoadingSpinner).exists()).toBe(false); expect(link).toHaveBeenCalledWith('primary_key'); }); test('unlinkHandler must run the unlink action', async () => { const unlink = jest.fn().mockReturnValue(Promise.resolve()); const wrapper = shallow( <GroupRow primary_key='primary_key' name='name' mattermost_group_id='group-id' has_syncables={undefined} checked={false} failed={false} onCheckToggle={jest.fn()} actions={{ link: jest.fn(), unlink, }} />, ); await wrapper.find('a').prop('onClick')?.({stopPropagation: jest.fn(), preventDefault: jest.fn()} as unknown as React.MouseEvent); expect(wrapper.find(LoadingSpinner).exists()).toBe(false); expect(unlink).toHaveBeenCalledWith('primary_key'); }); });
1,109
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_settings.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import GroupSettings from 'components/admin_console/group_settings/group_settings'; describe('components/admin_console/group_settings/GroupSettings', () => { test('should match snapshot', () => { const wrapper = shallow( <GroupSettings/>, ); expect(wrapper).toMatchSnapshot(); }); });
1,111
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/__snapshots__/group_row.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/group_settings/GroupRow should match snapshot, on checked row 1`] = ` <div className="group checked" id="name_group" onClick={[Function]} > <div className="group-row" > <div className="group-name" > <div className="group-check checked" > <CheckboxCheckedIcon /> </div> <span> name </span> </div> <div className="group-content" > <span className="group-description" > <a className="" href="#" onClick={[Function]} > <i className="icon fa fa-unlink" /> <MemoizedFormattedMessage defaultMessage="Not Linked" id="admin.group_settings.group_row.not_linked" /> </a> </span> <span className="group-actions" /> </div> </div> </div> `; exports[`components/admin_console/group_settings/GroupRow should match snapshot, on failed linked row 1`] = ` <div className="group " id="name_group" onClick={[Function]} > <div className="group-row" > <div className="group-name" > <div className="group-check " /> <span> name </span> </div> <div className="group-content" > <span className="group-description" > <a className="warning" href="#" onClick={[Function]} > <i className="icon fa fa-exclamation-triangle" /> <MemoizedFormattedMessage defaultMessage="Unlink failed" id="admin.group_settings.group_row.unlink_failed" /> </a> </span> <span className="group-actions" > <Link id="name_configure" to="/admin_console/user_management/groups/group-id" > <MemoizedFormattedMessage defaultMessage="Configure" id="admin.group_settings.group_row.configure" /> </Link> </span> </div> </div> </div> `; exports[`components/admin_console/group_settings/GroupRow should match snapshot, on failed not linked row 1`] = ` <div className="group " id="name_group" onClick={[Function]} > <div className="group-row" > <div className="group-name" > <div className="group-check " /> <span> name </span> </div> <div className="group-content" > <span className="group-description" > <a className="warning" href="#" onClick={[Function]} > <i className="icon fa fa-exclamation-triangle" /> <MemoizedFormattedMessage defaultMessage="Link failed" id="admin.group_settings.group_row.link_failed" /> </a> </span> <span className="group-actions" /> </div> </div> </div> `; exports[`components/admin_console/group_settings/GroupRow should match snapshot, on linked and configured row 1`] = ` <div className="group " id="name_group" onClick={[Function]} > <div className="group-row" > <div className="group-name" > <div className="group-check " /> <span> name </span> </div> <div className="group-content" > <span className="group-description" > <a className="" href="#" onClick={[Function]} > <i className="icon fa fa-link" /> <MemoizedFormattedMessage defaultMessage="Linked" id="admin.group_settings.group_row.linked" /> </a> </span> <span className="group-actions" > <Link id="name_edit" to="/admin_console/user_management/groups/group-id" > <MemoizedFormattedMessage defaultMessage="Edit" id="admin.group_settings.group_row.edit" /> </Link> </span> </div> </div> </div> `; exports[`components/admin_console/group_settings/GroupRow should match snapshot, on linked but not configured row 1`] = ` <div className="group " id="name_group" onClick={[Function]} > <div className="group-row" > <div className="group-name" > <div className="group-check " /> <span> name </span> </div> <div className="group-content" > <span className="group-description" > <a className="" href="#" onClick={[Function]} > <i className="icon fa fa-link" /> <MemoizedFormattedMessage defaultMessage="Linked" id="admin.group_settings.group_row.linked" /> </a> </span> <span className="group-actions" > <Link id="name_configure" to="/admin_console/user_management/groups/group-id" > <MemoizedFormattedMessage defaultMessage="Configure" id="admin.group_settings.group_row.configure" /> </Link> </span> </div> </div> </div> `; exports[`components/admin_console/group_settings/GroupRow should match snapshot, on not linked row 1`] = ` <div className="group " id="name_group" onClick={[Function]} > <div className="group-row" > <div className="group-name" > <div className="group-check " /> <span> name </span> </div> <div className="group-content" > <span className="group-description" > <a className="" href="#" onClick={[Function]} > <i className="icon fa fa-unlink" /> <MemoizedFormattedMessage defaultMessage="Not Linked" id="admin.group_settings.group_row.not_linked" /> </a> </span> <span className="group-actions" /> </div> </div> </div> `;
1,112
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/__snapshots__/group_settings.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/group_settings/GroupSettings should match snapshot 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Groups" id="admin.group_settings.groupsPageTitle" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="banner info" > <div className="banner__content" > <MemoizedFormattedMessage defaultMessage="Groups are a way to organize users and apply actions to all users within that group. For more information on Groups, please see <link>documentation</link>." id="admin.group_settings.introBanner" values={ Object { "link": [Function], } } /> </div> </div> <AdminPanel className="" id="ldap_groups" subtitleDefault="Connect AD/LDAP and create groups in Mattermost. To get started, configure group attributes on the <link>AD/LDAP</link> configuration page." subtitleId="admin.group_settings.ldapGroupsDescription" subtitleValues={ Object { "link": [Function], } } titleDefault="AD/LDAP Groups" titleId="admin.group_settings.ldapGroupsTitle" > <Connect(GroupsList) /> </AdminPanel> </div> </div> </div> `;
1,113
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/group_details.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import type {ChannelWithTeamData} from '@mattermost/types/channels'; import type {Group, GroupChannel, GroupTeam} from '@mattermost/types/groups'; import type {Team} from '@mattermost/types/teams'; import type {UserProfile} from '@mattermost/types/users'; import GroupDetails from 'components/admin_console/group_settings/group_details/group_details'; describe('components/admin_console/group_settings/group_details/GroupDetails', () => { const defaultProps = { groupID: 'xxxxxxxxxxxxxxxxxxxxxxxxxx', group: { display_name: 'Group', name: 'Group', } as Group, groupTeams: [ {team_id: '11111111111111111111111111'} as GroupTeam, {team_id: '22222222222222222222222222'} as GroupTeam, {team_id: '33333333333333333333333333'} as GroupTeam, ], groupChannels: [ {channel_id: '44444444444444444444444444'} as GroupChannel, {channel_id: '55555555555555555555555555'} as GroupChannel, {channel_id: '66666666666666666666666666'} as GroupChannel, ], members: [ {id: '77777777777777777777777777'} as UserProfile, {id: '88888888888888888888888888'} as UserProfile, {id: '99999999999999999999999999'} as UserProfile, ], memberCount: 20, actions: { getGroup: jest.fn().mockReturnValue(Promise.resolve()), getMembers: jest.fn().mockReturnValue(Promise.resolve()), getGroupStats: jest.fn().mockReturnValue(Promise.resolve()), getGroupSyncables: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), patchGroup: jest.fn(), patchGroupSyncable: jest.fn(), setNavigationBlocked: jest.fn(), }, }; test('should match snapshot, with everything closed', () => { const wrapper = shallow(<GroupDetails {...defaultProps}/>); defaultProps.actions.getGroupSyncables.mockClear(); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with add team selector open', () => { const wrapper = shallow(<GroupDetails {...defaultProps}/>); wrapper.setState({addTeamOpen: true}); defaultProps.actions.getGroupSyncables.mockClear(); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with add channel selector open', () => { const wrapper = shallow(<GroupDetails {...defaultProps}/>); wrapper.setState({addChannelOpen: true}); defaultProps.actions.getGroupSyncables.mockClear(); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with loaded state', () => { const wrapper = shallow(<GroupDetails {...defaultProps}/>); wrapper.setState({loading: false, loadingTeamsAndChannels: false}); defaultProps.actions.getGroupSyncables.mockClear(); expect(wrapper).toMatchSnapshot(); }); test('should load data on mount', () => { const actions = { getGroupSyncables: jest.fn().mockReturnValue(Promise.resolve()), getGroupStats: jest.fn().mockReturnValue(Promise.resolve()), getGroup: jest.fn().mockReturnValue(Promise.resolve()), getMembers: jest.fn(), link: jest.fn(), unlink: jest.fn(), patchGroup: jest.fn(), patchGroupSyncable: jest.fn(), setNavigationBlocked: jest.fn(), }; shallow( <GroupDetails {...defaultProps} actions={actions} />, ); expect(actions.getGroupSyncables).toBeCalledWith('xxxxxxxxxxxxxxxxxxxxxxxxxx', 'team'); expect(actions.getGroupSyncables).toBeCalledWith('xxxxxxxxxxxxxxxxxxxxxxxxxx', 'channel'); expect(actions.getGroupSyncables).toBeCalledTimes(2); expect(actions.getGroup).toBeCalledWith('xxxxxxxxxxxxxxxxxxxxxxxxxx'); }); test('should set state for each channel when addChannels is called', async () => { const actions = { getGroupSyncables: jest.fn().mockReturnValue(Promise.resolve()), getGroupStats: jest.fn().mockReturnValue(Promise.resolve()), getGroup: jest.fn().mockReturnValue(Promise.resolve()), getMembers: jest.fn(), link: jest.fn().mockReturnValue(Promise.resolve()), unlink: jest.fn().mockReturnValue(Promise.resolve()), patchGroup: jest.fn(), patchGroupSyncable: jest.fn(), setNavigationBlocked: jest.fn(), }; const wrapper = shallow<GroupDetails>( <GroupDetails {...defaultProps} actions={actions} />, ); const instance = wrapper.instance(); await instance.addChannels([ {id: '11111111111111111111111111'} as ChannelWithTeamData, {id: '22222222222222222222222222'} as ChannelWithTeamData, ]); const testStateObj = (stateSubset?: GroupChannel[]) => { const channelIDs = stateSubset?.map((gc) => gc.channel_id); expect(channelIDs).toContain('11111111111111111111111111'); expect(channelIDs).toContain('22222222222222222222222222'); }; testStateObj(instance.state.groupChannels); testStateObj(instance.state.channelsToAdd); }); test('should set state for each team when addTeams is called', async () => { const actions = { getGroupSyncables: jest.fn().mockReturnValue(Promise.resolve()), getGroupStats: jest.fn().mockReturnValue(Promise.resolve()), getGroup: jest.fn().mockReturnValue(Promise.resolve()), getMembers: jest.fn(), link: jest.fn().mockReturnValue(Promise.resolve()), unlink: jest.fn().mockReturnValue(Promise.resolve()), patchGroup: jest.fn(), patchGroupSyncable: jest.fn(), setNavigationBlocked: jest.fn(), }; const wrapper = shallow<GroupDetails>( <GroupDetails {...defaultProps} actions={actions} />, ); const instance = wrapper.instance(); expect(instance.state.groupTeams?.length === 0); instance.addTeams([ {id: '11111111111111111111111111'} as Team, {id: '22222222222222222222222222'} as Team, ]); const testStateObj = (stateSubset?: GroupTeam[]) => { const teamIDs = stateSubset?.map((gt) => gt.team_id); expect(teamIDs).toContain('11111111111111111111111111'); expect(teamIDs).toContain('22222222222222222222222222'); }; testStateObj(instance.state.groupTeams); testStateObj(instance.state.teamsToAdd); }); test('update name for null slug', async () => { const wrapper = shallow<GroupDetails>( <GroupDetails {...defaultProps} group={{ display_name: 'test group', allow_reference: false, } as Group} />, ); wrapper.instance().onMentionToggle(true); expect(wrapper.state().groupMentionName).toBe('test-group'); }); test('update name for empty slug', async () => { const wrapper = shallow<GroupDetails>( <GroupDetails {...defaultProps} group={{ name: '', display_name: 'test group', allow_reference: false, } as Group} />, ); wrapper.instance().onMentionToggle(true); expect(wrapper.state().groupMentionName).toBe('test-group'); }); test('Should not update name for slug', async () => { const wrapper = shallow<GroupDetails>( <GroupDetails {...defaultProps} group={{ name: 'any_name_at_all', display_name: 'test group', allow_reference: false, } as Group} />, ); wrapper.instance().onMentionToggle(true); expect(wrapper.state().groupMentionName).toBe('any_name_at_all'); }); });
1,115
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/group_profile.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import GroupProfile from 'components/admin_console/group_settings/group_details/group_profile'; describe('components/admin_console/group_settings/group_details/GroupProfile', () => { test('should match snapshot', () => { const wrapper = shallow( <GroupProfile isDisabled={false} name='Test' showAtMention={true} title='admin.group_settings.group_details.group_profile.name' titleDefault='Name:' />, ); expect(wrapper).toMatchSnapshot(); }); });
1,117
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/group_profile_and_settings.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import {GroupProfileAndSettings} from './group_profile_and_settings'; describe('components/admin_console/group_settings/group_details/GroupProfileAndSettings', () => { test('should match snapshot, with toggle off', () => { const wrapper = shallow( <GroupProfileAndSettings displayname='GroupProfileAndSettings' mentionname='GroupProfileAndSettings' allowReference={false} onChange={jest.fn()} onToggle={jest.fn()} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with toggle on', () => { const wrapper = shallow( <GroupProfileAndSettings displayname='GroupProfileAndSettings' mentionname='GroupProfileAndSettings' allowReference={true} onChange={jest.fn()} onToggle={jest.fn()} />, ); expect(wrapper).toMatchSnapshot(); }); });
1,119
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/group_teams_and_channels.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import GroupTeamsAndChannels from 'components/admin_console/group_settings/group_details/group_teams_and_channels'; describe('components/admin_console/group_settings/group_details/GroupTeamsAndChannels', () => { const defaultProps = { id: 'xxxxxxxxxxxxxxxxxxxxxxxxxx', teams: [ { team_id: '11111111111111111111111111', team_type: 'O', team_display_name: 'Team 1', }, { team_id: '22222222222222222222222222', team_type: 'P', team_display_name: 'Team 2', }, { team_id: '33333333333333333333333333', team_type: 'P', team_display_name: 'Team 3', }, ], channels: [ { team_id: '11111111111111111111111111', team_type: 'O', team_display_name: 'Team 1', channel_id: '44444444444444444444444444', channel_type: 'O', channel_display_name: 'Channel 4', }, { team_id: '99999999999999999999999999', team_type: 'O', team_display_name: 'Team 9', channel_id: '55555555555555555555555555', channel_type: 'P', channel_display_name: 'Channel 5', }, { team_id: '99999999999999999999999999', team_type: 'O', team_display_name: 'Team 9', channel_id: '55555555555555555555555555', channel_type: 'P', channel_display_name: 'Channel 5', }, ], loading: false, getGroupSyncables: jest.fn().mockReturnValue(Promise.resolve()), unlink: jest.fn(), onChangeRoles: jest.fn(), onRemoveItem: jest.fn(), }; test('should match snapshot, with teams, with channels and loading', () => { const wrapper = shallow( <GroupTeamsAndChannels {...defaultProps} loading={true} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with teams, with channels and loaded', () => { const wrapper = shallow( <GroupTeamsAndChannels {...defaultProps} loading={false} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, without teams, without channels and loading', () => { const wrapper = shallow( <GroupTeamsAndChannels {...defaultProps} teams={[]} channels={[]} loading={true} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, without teams, without channels and loaded', () => { const wrapper = shallow( <GroupTeamsAndChannels {...defaultProps} teams={[]} channels={[]} loading={false} />, ); expect(wrapper).toMatchSnapshot(); }); test('should toggle the collapse for an element', () => { const wrapper = shallow<GroupTeamsAndChannels>(<GroupTeamsAndChannels {...defaultProps}/>); const instance = wrapper.instance(); expect( Boolean(wrapper.state().collapsed['11111111111111111111111111']), ).toBe(false); expect( Boolean(wrapper.state().collapsed['22222222222222222222222222']), ).toBe(false); instance.onToggleCollapse('11111111111111111111111111'); expect( Boolean(wrapper.state().collapsed['11111111111111111111111111']), ).toBe(true); expect( Boolean(wrapper.state().collapsed['22222222222222222222222222']), ).toBe(false); instance.onToggleCollapse('11111111111111111111111111'); expect( Boolean(wrapper.state().collapsed['11111111111111111111111111']), ).toBe(false); expect( Boolean(wrapper.state().collapsed['22222222222222222222222222']), ).toBe(false); }); test('should invoke the onRemoveItem callback', async () => { const onRemoveItem = jest.fn(); const wrapper = shallow<GroupTeamsAndChannels>( <GroupTeamsAndChannels {...defaultProps} onChangeRoles={jest.fn()} onRemoveItem={onRemoveItem} />, ); const instance = wrapper.instance(); instance.onRemoveItem('11111111111111111111111111', 'public-team'); expect(onRemoveItem).toBeCalledWith( '11111111111111111111111111', 'public-team', ); }); test('should invoke the onChangeRoles callback', async () => { const onChangeRoles = jest.fn(); const wrapper = shallow<GroupTeamsAndChannels>( <GroupTeamsAndChannels {...defaultProps} onChangeRoles={onChangeRoles} onRemoveItem={jest.fn()} />, ); const instance = wrapper.instance(); instance.onChangeRoles( '11111111111111111111111111', 'public-team', true, ); expect(onChangeRoles).toBeCalledWith( '11111111111111111111111111', 'public-team', true, ); }); });
1,121
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/group_teams_and_channels_row.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import GroupTeamsAndChannelsRow from 'components/admin_console/group_settings/group_details/group_teams_and_channels_row'; describe('components/admin_console/group_settings/group_details/GroupTeamsAndChannelsRow', () => { for (const type of [ 'public-team', 'private-team', 'public-channel', 'private-channel', ]) { test('should match snapshot, for ' + type, () => { const wrapper = shallow( <GroupTeamsAndChannelsRow id='xxxxxxxxxxxxxxxxxxxxxxxxxx' type={type} name={'Test ' + type} hasChildren={false} collapsed={false} onRemoveItem={jest.fn()} onToggleCollapse={jest.fn()} onChangeRoles={jest.fn()} />, ); expect(wrapper).toMatchSnapshot(); }); } test('should match snapshot, when has children', () => { const wrapper = shallow( <GroupTeamsAndChannelsRow id='xxxxxxxxxxxxxxxxxxxxxxxxxx' type='public-team' name={'Test team with children'} hasChildren={true} collapsed={false} onRemoveItem={jest.fn()} onToggleCollapse={jest.fn()} onChangeRoles={jest.fn()} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, when has children and is collapsed', () => { const wrapper = shallow( <GroupTeamsAndChannelsRow id='xxxxxxxxxxxxxxxxxxxxxxxxxx' type='public-team' name={'Test team with children'} hasChildren={true} collapsed={true} onRemoveItem={jest.fn()} onToggleCollapse={jest.fn()} onChangeRoles={jest.fn()} />, ); expect(wrapper).toMatchSnapshot(); }); test('should call onToggleCollapse on caret click', () => { const onToggleCollapse = jest.fn(); const wrapper = shallow( <GroupTeamsAndChannelsRow id='xxxxxxxxxxxxxxxxxxxxxxxxxx' type='public-team' name={'Test team with children'} hasChildren={true} collapsed={true} onRemoveItem={jest.fn()} onToggleCollapse={onToggleCollapse} onChangeRoles={jest.fn()} />, ); wrapper.find('.fa-caret-right').simulate('click'); expect(onToggleCollapse).toBeCalledWith('xxxxxxxxxxxxxxxxxxxxxxxxxx'); }); test('should call onRemoveItem on remove link click', () => { const onRemoveItem = jest.fn(); const wrapper = shallow<GroupTeamsAndChannelsRow>( <GroupTeamsAndChannelsRow id='xxxxxxxxxxxxxxxxxxxxxxxxxx' type='public-team' name={'Test team with children'} hasChildren={true} collapsed={true} onRemoveItem={onRemoveItem} onToggleCollapse={jest.fn()} onChangeRoles={jest.fn()} />, ); wrapper.find('.btn-tertiary').simulate('click'); expect(wrapper.instance().state.showConfirmationModal).toEqual(true); wrapper.instance().removeItem(); expect(onRemoveItem).toBeCalledWith( 'xxxxxxxxxxxxxxxxxxxxxxxxxx', 'public-team', ); expect(wrapper.instance().state.showConfirmationModal).toEqual(false); }); });
1,123
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/group_users.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import {range} from 'lodash'; import React from 'react'; import type {UserProfile} from '@mattermost/types/users'; import GroupUsers from 'components/admin_console/group_settings/group_details/group_users'; describe('components/admin_console/group_settings/group_details/GroupUsers', () => { const members = range(0, 55).map((i) => ({ id: 'id' + i, username: 'username' + i, first_name: 'Name' + i, last_name: 'Surname' + i, email: 'test' + i + '@test.com', last_picture_update: i, } as UserProfile)); const defaultProps = { groupID: 'xxxxxxxxxxxxxxxxxxxxxxxxxx', members: members.slice(0, 20), total: 20, getMembers: jest.fn().mockReturnValue(Promise.resolve()), }; test('should match snapshot, on loading without data', () => { const wrapper = shallow( <GroupUsers {...defaultProps} members={[]} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, on loading with data', () => { const wrapper = shallow(<GroupUsers {...defaultProps}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, loaded without data', () => { const wrapper = shallow( <GroupUsers {...defaultProps} members={[]} />, ); wrapper.setState({loading: false}); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, loaded with data', () => { const wrapper = shallow(<GroupUsers {...defaultProps}/>); wrapper.setState({loading: false}); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, loaded with one page', () => { const wrapper = shallow(<GroupUsers {...defaultProps}/>); wrapper.setState({loading: false}); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, loaded with multiple pages', () => { const wrapper = shallow( <GroupUsers {...defaultProps} members={members.slice(0, 55)} total={55} />, ); // First page wrapper.setState({loading: false, page: 0}); expect(wrapper).toMatchSnapshot(); // Intermediate page wrapper.setState({loading: false, page: 1}); expect(wrapper).toMatchSnapshot(); // Last page page wrapper.setState({loading: false, page: 2}); expect(wrapper).toMatchSnapshot(); }); test('should get the members on mount', () => { const getMembers = jest.fn().mockReturnValue(Promise.resolve()); const wrapper = shallow<GroupUsers>( <GroupUsers {...defaultProps} getMembers={getMembers} />, ); wrapper.instance().componentDidMount(); expect(getMembers).toBeCalledWith('xxxxxxxxxxxxxxxxxxxxxxxxxx', 0, 20); }); test('should change the page and not call get members on previous click', async () => { const wrapper = shallow<GroupUsers>( <GroupUsers {...defaultProps} members={members.slice(0, 55)} total={55} />, ); const instance = wrapper.instance(); wrapper.setState({page: 2}); await instance.previousPage(); expect(wrapper.state().page).toBe(1); await instance.previousPage(); expect(wrapper.state().page).toBe(0); await instance.previousPage(); expect(wrapper.state().page).toBe(0); }); test('should change the page and get the members on next click', async () => { const getMembers = jest.fn().mockReturnValue(Promise.resolve()); const wrapper = shallow<GroupUsers>( <GroupUsers {...defaultProps} getMembers={getMembers} total={55} />, ); const instance = wrapper.instance(); getMembers.mockClear(); wrapper.setState({page: 0}); await instance.nextPage(); expect(getMembers).toBeCalledWith('xxxxxxxxxxxxxxxxxxxxxxxxxx', 1, 20); wrapper.setProps({members: members.slice(0, 40)}); expect(wrapper.state().page).toBe(1); getMembers.mockClear(); await instance.nextPage(); expect(getMembers).toBeCalledWith('xxxxxxxxxxxxxxxxxxxxxxxxxx', 2, 20); wrapper.setProps({members: members.slice(0, 55)}); expect(wrapper.state().page).toBe(2); getMembers.mockClear(); await instance.nextPage(); expect(wrapper.state().page).toBe(2); }); });
1,125
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/group_users_row.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import GroupUsersRow from 'components/admin_console/group_settings/group_details/group_users_row'; describe('components/admin_console/group_settings/group_details/GroupUsersRow', () => { test('should match snapshot', () => { const wrapper = shallow( <GroupUsersRow username='test' displayName='Test display name' email='[email protected]' userId='xxxxxxxxxxxxxxxxxxxxxxxxxx' lastPictureUpdate={0} />, ); expect(wrapper).toMatchSnapshot(); }); });
1,128
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/__snapshots__/group_details.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/group_settings/group_details/GroupDetails should match snapshot, with add channel selector open 1`] = ` <div className="wrapper--fixed" > <AdminHeader withBackButton={true} > <div> <Connect(Component) className="fa fa-angle-left back" to="/admin_console/user_management/groups" /> <MemoizedFormattedMessage defaultMessage="Group Configuration" id="admin.group_settings.group_detail.group_configuration" /> </div> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="banner info" > <div className="banner__content" > <MemoizedFormattedMessage defaultMessage="Configure default teams and channels and view users belonging to this group." id="admin.group_settings.group_detail.introBanner" /> </div> </div> <GroupProfileAndSettings allowReference={false} displayname="Group" mentionname="Group" onChange={[Function]} onToggle={[Function]} /> <AdminPanel button={ <div className="group-profile-add-menu" > <MenuWrapper animationComponent={[Function]} className="" > <button className="btn btn-primary" id="add_team_or_channel" type="button" > <Memo(MemoizedFormattedMessage) defaultMessage="Add Team or Channel" id="admin.group_settings.group_details.add_team_or_channel" /> <i className="fa fa-caret-down" /> </button> <Menu ariaLabel="Add Team or Channel Menu" > <MenuItemAction id="add_team" onClick={[Function]} show={true} text="Add Team" /> <MenuItemAction id="add_channel" onClick={[Function]} show={true} text="Add Channel" /> </Menu> </MenuWrapper> </div> } className="" id="group_teams_and_channels" subtitleDefault="Set default teams and channels for group members. Teams added will include default channels, town-square, and off-topic. Adding a channel without setting the team will add the implied team to the listing below." subtitleId="admin.group_settings.group_detail.groupTeamsAndChannelsDescription" titleDefault="Team and Channel Membership" titleId="admin.group_settings.group_detail.groupTeamsAndChannelsTitle" > <GroupTeamsAndChannels channels={Array []} id="xxxxxxxxxxxxxxxxxxxxxxxxxx" loading={true} onChangeRoles={[Function]} onRemoveItem={[Function]} teams={Array []} /> </AdminPanel> <Connect(ChannelSelectorModal) alreadySelected={ Array [ "44444444444444444444444444", "55555555555555555555555555", "66666666666666666666666666", ] } groupID="xxxxxxxxxxxxxxxxxxxxxxxxxx" onChannelsSelected={[Function]} onModalDismissed={[Function]} /> <AdminPanel className="" id="group_users" subtitleDefault="Listing of users in Mattermost associated with this group." subtitleId="admin.group_settings.group_detail.groupUsersDescription" titleDefault="Users" titleId="admin.group_settings.group_detail.groupUsersTitle" > <GroupUsers getMembers={[MockFunction]} groupID="xxxxxxxxxxxxxxxxxxxxxxxxxx" members={ Array [ Object { "id": "77777777777777777777777777", }, Object { "id": "88888888888888888888888888", }, Object { "id": "99999999999999999999999999", }, ] } total={20} /> </AdminPanel> </div> </div> <SaveChangesPanel cancelLink="/admin_console/user_management/groups" onClick={[Function]} saveNeeded={false} saving={false} /> </div> `; exports[`components/admin_console/group_settings/group_details/GroupDetails should match snapshot, with add team selector open 1`] = ` <div className="wrapper--fixed" > <AdminHeader withBackButton={true} > <div> <Connect(Component) className="fa fa-angle-left back" to="/admin_console/user_management/groups" /> <MemoizedFormattedMessage defaultMessage="Group Configuration" id="admin.group_settings.group_detail.group_configuration" /> </div> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="banner info" > <div className="banner__content" > <MemoizedFormattedMessage defaultMessage="Configure default teams and channels and view users belonging to this group." id="admin.group_settings.group_detail.introBanner" /> </div> </div> <GroupProfileAndSettings allowReference={false} displayname="Group" mentionname="Group" onChange={[Function]} onToggle={[Function]} /> <AdminPanel button={ <div className="group-profile-add-menu" > <MenuWrapper animationComponent={[Function]} className="" > <button className="btn btn-primary" id="add_team_or_channel" type="button" > <Memo(MemoizedFormattedMessage) defaultMessage="Add Team or Channel" id="admin.group_settings.group_details.add_team_or_channel" /> <i className="fa fa-caret-down" /> </button> <Menu ariaLabel="Add Team or Channel Menu" > <MenuItemAction id="add_team" onClick={[Function]} show={true} text="Add Team" /> <MenuItemAction id="add_channel" onClick={[Function]} show={true} text="Add Channel" /> </Menu> </MenuWrapper> </div> } className="" id="group_teams_and_channels" subtitleDefault="Set default teams and channels for group members. Teams added will include default channels, town-square, and off-topic. Adding a channel without setting the team will add the implied team to the listing below." subtitleId="admin.group_settings.group_detail.groupTeamsAndChannelsDescription" titleDefault="Team and Channel Membership" titleId="admin.group_settings.group_detail.groupTeamsAndChannelsTitle" > <GroupTeamsAndChannels channels={Array []} id="xxxxxxxxxxxxxxxxxxxxxxxxxx" loading={true} onChangeRoles={[Function]} onRemoveItem={[Function]} teams={Array []} /> </AdminPanel> <Connect(TeamSelectorModal) alreadySelected={ Array [ "11111111111111111111111111", "22222222222222222222222222", "33333333333333333333333333", ] } onModalDismissed={[Function]} onTeamsSelected={[Function]} /> <AdminPanel className="" id="group_users" subtitleDefault="Listing of users in Mattermost associated with this group." subtitleId="admin.group_settings.group_detail.groupUsersDescription" titleDefault="Users" titleId="admin.group_settings.group_detail.groupUsersTitle" > <GroupUsers getMembers={[MockFunction]} groupID="xxxxxxxxxxxxxxxxxxxxxxxxxx" members={ Array [ Object { "id": "77777777777777777777777777", }, Object { "id": "88888888888888888888888888", }, Object { "id": "99999999999999999999999999", }, ] } total={20} /> </AdminPanel> </div> </div> <SaveChangesPanel cancelLink="/admin_console/user_management/groups" onClick={[Function]} saveNeeded={false} saving={false} /> </div> `; exports[`components/admin_console/group_settings/group_details/GroupDetails should match snapshot, with everything closed 1`] = ` <div className="wrapper--fixed" > <AdminHeader withBackButton={true} > <div> <Connect(Component) className="fa fa-angle-left back" to="/admin_console/user_management/groups" /> <MemoizedFormattedMessage defaultMessage="Group Configuration" id="admin.group_settings.group_detail.group_configuration" /> </div> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="banner info" > <div className="banner__content" > <MemoizedFormattedMessage defaultMessage="Configure default teams and channels and view users belonging to this group." id="admin.group_settings.group_detail.introBanner" /> </div> </div> <GroupProfileAndSettings allowReference={false} displayname="Group" mentionname="Group" onChange={[Function]} onToggle={[Function]} /> <AdminPanel button={ <div className="group-profile-add-menu" > <MenuWrapper animationComponent={[Function]} className="" > <button className="btn btn-primary" id="add_team_or_channel" type="button" > <Memo(MemoizedFormattedMessage) defaultMessage="Add Team or Channel" id="admin.group_settings.group_details.add_team_or_channel" /> <i className="fa fa-caret-down" /> </button> <Menu ariaLabel="Add Team or Channel Menu" > <MenuItemAction id="add_team" onClick={[Function]} show={true} text="Add Team" /> <MenuItemAction id="add_channel" onClick={[Function]} show={true} text="Add Channel" /> </Menu> </MenuWrapper> </div> } className="" id="group_teams_and_channels" subtitleDefault="Set default teams and channels for group members. Teams added will include default channels, town-square, and off-topic. Adding a channel without setting the team will add the implied team to the listing below." subtitleId="admin.group_settings.group_detail.groupTeamsAndChannelsDescription" titleDefault="Team and Channel Membership" titleId="admin.group_settings.group_detail.groupTeamsAndChannelsTitle" > <GroupTeamsAndChannels channels={Array []} id="xxxxxxxxxxxxxxxxxxxxxxxxxx" loading={true} onChangeRoles={[Function]} onRemoveItem={[Function]} teams={Array []} /> </AdminPanel> <AdminPanel className="" id="group_users" subtitleDefault="Listing of users in Mattermost associated with this group." subtitleId="admin.group_settings.group_detail.groupUsersDescription" titleDefault="Users" titleId="admin.group_settings.group_detail.groupUsersTitle" > <GroupUsers getMembers={[MockFunction]} groupID="xxxxxxxxxxxxxxxxxxxxxxxxxx" members={ Array [ Object { "id": "77777777777777777777777777", }, Object { "id": "88888888888888888888888888", }, Object { "id": "99999999999999999999999999", }, ] } total={20} /> </AdminPanel> </div> </div> <SaveChangesPanel cancelLink="/admin_console/user_management/groups" onClick={[Function]} saveNeeded={false} saving={false} /> </div> `; exports[`components/admin_console/group_settings/group_details/GroupDetails should match snapshot, with loaded state 1`] = ` <div className="wrapper--fixed" > <AdminHeader withBackButton={true} > <div> <Connect(Component) className="fa fa-angle-left back" to="/admin_console/user_management/groups" /> <MemoizedFormattedMessage defaultMessage="Group Configuration" id="admin.group_settings.group_detail.group_configuration" /> </div> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="banner info" > <div className="banner__content" > <MemoizedFormattedMessage defaultMessage="Configure default teams and channels and view users belonging to this group." id="admin.group_settings.group_detail.introBanner" /> </div> </div> <GroupProfileAndSettings allowReference={false} displayname="Group" mentionname="Group" onChange={[Function]} onToggle={[Function]} /> <AdminPanel button={ <div className="group-profile-add-menu" > <MenuWrapper animationComponent={[Function]} className="" > <button className="btn btn-primary" id="add_team_or_channel" type="button" > <Memo(MemoizedFormattedMessage) defaultMessage="Add Team or Channel" id="admin.group_settings.group_details.add_team_or_channel" /> <i className="fa fa-caret-down" /> </button> <Menu ariaLabel="Add Team or Channel Menu" > <MenuItemAction id="add_team" onClick={[Function]} show={true} text="Add Team" /> <MenuItemAction id="add_channel" onClick={[Function]} show={true} text="Add Channel" /> </Menu> </MenuWrapper> </div> } className="" id="group_teams_and_channels" subtitleDefault="Set default teams and channels for group members. Teams added will include default channels, town-square, and off-topic. Adding a channel without setting the team will add the implied team to the listing below." subtitleId="admin.group_settings.group_detail.groupTeamsAndChannelsDescription" titleDefault="Team and Channel Membership" titleId="admin.group_settings.group_detail.groupTeamsAndChannelsTitle" > <GroupTeamsAndChannels channels={Array []} id="xxxxxxxxxxxxxxxxxxxxxxxxxx" loading={false} onChangeRoles={[Function]} onRemoveItem={[Function]} teams={Array []} /> </AdminPanel> <AdminPanel className="" id="group_users" subtitleDefault="Listing of users in Mattermost associated with this group." subtitleId="admin.group_settings.group_detail.groupUsersDescription" titleDefault="Users" titleId="admin.group_settings.group_detail.groupUsersTitle" > <GroupUsers getMembers={[MockFunction]} groupID="xxxxxxxxxxxxxxxxxxxxxxxxxx" members={ Array [ Object { "id": "77777777777777777777777777", }, Object { "id": "88888888888888888888888888", }, Object { "id": "99999999999999999999999999", }, ] } total={20} /> </AdminPanel> </div> </div> <SaveChangesPanel cancelLink="/admin_console/user_management/groups" onClick={[Function]} saveNeeded={false} saving={false} /> </div> `;
1,129
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/__snapshots__/group_profile.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/group_settings/group_details/GroupProfile should match snapshot 1`] = ` <div className="group-profile form-horizontal" > <div className="group-profile-field form-group mb-0" > <label className="control-label col-sm-4" > <MemoizedFormattedMessage defaultMessage="Name:" id="admin.group_settings.group_details.group_profile.name" /> </label> <div className="col-sm-8" > <div className="icon-over-input" > <MentionsIcon aria-hidden="true" className="icon icon__mentions" /> </div> <input className="form-control group-at-mention-input" disabled={false} type="text" value="Test" /> </div> </div> </div> `;
1,130
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/__snapshots__/group_profile_and_settings.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/group_settings/group_details/GroupProfileAndSettings should match snapshot, with toggle off 1`] = ` <AdminPanel className="" id="group_profile" subtitleDefault="The name for this group." subtitleId="admin.group_settings.group_detail.groupProfileDescription" titleDefault="Group Profile" titleId="admin.group_settings.group_detail.groupProfileTitle" > <GroupProfile customID="groupDisplayName" isDisabled={true} name="GroupProfileAndSettings" showAtMention={false} title="admin.group_settings.group_details.group_profile.name" titleDefault="Name:" /> <div className="group-settings" > <div className="group-settings--body" > <div className="section-separator" > <hr className="separator__hr" /> </div> <GroupSettingsToggle allowReference={false} isDefault={false} onToggle={[MockFunction]} /> </div> </div> </AdminPanel> `; exports[`components/admin_console/group_settings/group_details/GroupProfileAndSettings should match snapshot, with toggle on 1`] = ` <AdminPanel className="" id="group_profile" subtitleDefault="The name for this group." subtitleId="admin.group_settings.group_detail.groupProfileDescription" titleDefault="Group Profile" titleId="admin.group_settings.group_detail.groupProfileTitle" > <GroupProfile customID="groupDisplayName" isDisabled={true} name="GroupProfileAndSettings" showAtMention={false} title="admin.group_settings.group_details.group_profile.name" titleDefault="Name:" /> <div className="group-settings" > <div className="group-settings--body" > <div className="section-separator" > <hr className="separator__hr" /> </div> <GroupSettingsToggle allowReference={true} isDefault={false} onToggle={[MockFunction]} /> </div> </div> <GroupProfile customID="groupMention" name="GroupProfileAndSettings" onChange={[MockFunction]} showAtMention={true} title="admin.group_settings.group_details.group_mention.name" titleDefault="Group Mention:" /> </AdminPanel> `;
1,131
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/__snapshots__/group_teams_and_channels.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/group_settings/group_details/GroupTeamsAndChannels should match snapshot, with teams, with channels and loaded 1`] = ` <div className="AdminPanel__content" > <table className="AdminPanel__table group-teams-and-channels" id="team_and_channel_membership_table" > <thead className="group-teams-and-channels--header" > <tr> <th style={ Object { "width": "30%", } } > <MemoizedFormattedMessage defaultMessage="Name" id="admin.group_settings.group_profile.group_teams_and_channels.name" /> </th> <th style={ Object { "width": "25%", } } > <MemoizedFormattedMessage defaultMessage="Type" id="admin.group_settings.group_profile.group_teams_and_channels.type" /> </th> <th style={ Object { "width": "25%", } } > <MemoizedFormattedMessage defaultMessage="Assigned Roles" id="admin.group_settings.group_profile.group_teams_and_channels.assignedRoles" /> </th> <th style={ Object { "width": "20%", } } /> </tr> </thead> <tbody className="group-teams-and-channels--body" > <GroupTeamsAndChannelsRow hasChildren={true} id="11111111111111111111111111" key="11111111111111111111111111" name="Team 1" onChangeRoles={[Function]} onRemoveItem={[Function]} onToggleCollapse={[Function]} type="public-team" /> <GroupTeamsAndChannelsRow id="44444444444444444444444444" key="44444444444444444444444444" name="Channel 4" onChangeRoles={[Function]} onRemoveItem={[Function]} onToggleCollapse={[Function]} type="public-channel" /> <GroupTeamsAndChannelsRow hasChildren={false} id="22222222222222222222222222" key="22222222222222222222222222" name="Team 2" onChangeRoles={[Function]} onRemoveItem={[Function]} onToggleCollapse={[Function]} type="private-team" /> <GroupTeamsAndChannelsRow hasChildren={false} id="33333333333333333333333333" key="33333333333333333333333333" name="Team 3" onChangeRoles={[Function]} onRemoveItem={[Function]} onToggleCollapse={[Function]} type="private-team" /> <GroupTeamsAndChannelsRow hasChildren={true} id="99999999999999999999999999" key="99999999999999999999999999" name="Team 9" onChangeRoles={[Function]} onRemoveItem={[Function]} onToggleCollapse={[Function]} type="public-team" /> <GroupTeamsAndChannelsRow id="55555555555555555555555555" key="55555555555555555555555555" name="Channel 5" onChangeRoles={[Function]} onRemoveItem={[Function]} onToggleCollapse={[Function]} type="private-channel" /> <GroupTeamsAndChannelsRow id="55555555555555555555555555" key="55555555555555555555555555" name="Channel 5" onChangeRoles={[Function]} onRemoveItem={[Function]} onToggleCollapse={[Function]} type="private-channel" /> </tbody> </table> </div> `; exports[`components/admin_console/group_settings/group_details/GroupTeamsAndChannels should match snapshot, with teams, with channels and loading 1`] = ` <div className="group-teams-and-channels" > <div className="group-teams-and-channels-loading" > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> </div> `; exports[`components/admin_console/group_settings/group_details/GroupTeamsAndChannels should match snapshot, without teams, without channels and loaded 1`] = ` <div className="group-teams-and-channels" > <div className="group-teams-and-channels-empty" > <MemoizedFormattedMessage defaultMessage="No teams or channels specified yet" id="admin.group_settings.group_details.group_teams_and_channels.no-teams-or-channels-speicified" /> </div> </div> `; exports[`components/admin_console/group_settings/group_details/GroupTeamsAndChannels should match snapshot, without teams, without channels and loading 1`] = ` <div className="group-teams-and-channels" > <div className="group-teams-and-channels-loading" > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> </div> `;
1,132
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/__snapshots__/group_teams_and_channels_row.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/group_settings/group_details/GroupTeamsAndChannelsRow should match snapshot, for private-channel 1`] = ` <tr className="group-teams-and-channels-row" > <ConfirmModal confirmButtonClass="btn btn-primary" confirmButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Yes, Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_button" /> } message={ <Memo(MemoizedFormattedMessage) defaultMessage="Removing this membership will prevent future users in this group from being added to the {name} {displayType}." id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_body" values={ Object { "displayType": "channel", "name": "Test private-channel", } } /> } modalClass="" onCancel={[Function]} onConfirm={[Function]} show={false} title={ <Memo(MemoizedFormattedMessage) defaultMessage="Remove Membership from the {name} {displayType}?" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_header" values={ Object { "displayType": "channel", "name": "Test private-channel", } } /> } /> <td> <span className="arrow-icon" /> <span className="channel-icon" > <LockIcon className="icon icon__lock" /> </span> <span className="" > Test private-channel </span> </td> <td className="type" > <MemoizedFormattedMessage defaultMessage="Channel (Private)" id="admin.group_settings.group_details.group_teams_and_channels_row.privateChannel" /> </td> <td /> <td className="text-right" > <button className="btn btn-tertiary" data-testid="Test private-channel_groupsyncable_remove" onClick={[Function]} type="button" > <MemoizedFormattedMessage defaultMessage="Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove" /> </button> </td> </tr> `; exports[`components/admin_console/group_settings/group_details/GroupTeamsAndChannelsRow should match snapshot, for private-team 1`] = ` <tr className="group-teams-and-channels-row" > <ConfirmModal confirmButtonClass="btn btn-primary" confirmButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Yes, Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_button" /> } message={ <Memo(MemoizedFormattedMessage) defaultMessage="Removing this membership will prevent future users in this group from being added to the {name} {displayType}." id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_body" values={ Object { "displayType": "team", "name": "Test private-team", } } /> } modalClass="" onCancel={[Function]} onConfirm={[Function]} show={false} title={ <Memo(MemoizedFormattedMessage) defaultMessage="Remove Membership from the {name} {displayType}?" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_header" values={ Object { "displayType": "team", "name": "Test private-team", } } /> } /> <td> <span className="arrow-icon" /> <span className="name-no-arrow" > Test private-team </span> </td> <td className="type" > <MemoizedFormattedMessage defaultMessage="Team (Private)" id="admin.group_settings.group_details.group_teams_and_channels_row.privateTeam" /> </td> <td /> <td className="text-right" > <button className="btn btn-tertiary" data-testid="Test private-team_groupsyncable_remove" onClick={[Function]} type="button" > <MemoizedFormattedMessage defaultMessage="Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove" /> </button> </td> </tr> `; exports[`components/admin_console/group_settings/group_details/GroupTeamsAndChannelsRow should match snapshot, for public-channel 1`] = ` <tr className="group-teams-and-channels-row" > <ConfirmModal confirmButtonClass="btn btn-primary" confirmButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Yes, Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_button" /> } message={ <Memo(MemoizedFormattedMessage) defaultMessage="Removing this membership will prevent future users in this group from being added to the {name} {displayType}." id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_body" values={ Object { "displayType": "channel", "name": "Test public-channel", } } /> } modalClass="" onCancel={[Function]} onConfirm={[Function]} show={false} title={ <Memo(MemoizedFormattedMessage) defaultMessage="Remove Membership from the {name} {displayType}?" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_header" values={ Object { "displayType": "channel", "name": "Test public-channel", } } /> } /> <td> <span className="arrow-icon" /> <span className="channel-icon" > <GlobeIcon className="icon icon__globe" /> </span> <span className="" > Test public-channel </span> </td> <td className="type" > <MemoizedFormattedMessage defaultMessage="Channel" id="admin.group_settings.group_details.group_teams_and_channels_row.publicChannel" /> </td> <td /> <td className="text-right" > <button className="btn btn-tertiary" data-testid="Test public-channel_groupsyncable_remove" onClick={[Function]} type="button" > <MemoizedFormattedMessage defaultMessage="Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove" /> </button> </td> </tr> `; exports[`components/admin_console/group_settings/group_details/GroupTeamsAndChannelsRow should match snapshot, for public-team 1`] = ` <tr className="group-teams-and-channels-row" > <ConfirmModal confirmButtonClass="btn btn-primary" confirmButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Yes, Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_button" /> } message={ <Memo(MemoizedFormattedMessage) defaultMessage="Removing this membership will prevent future users in this group from being added to the {name} {displayType}." id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_body" values={ Object { "displayType": "team", "name": "Test public-team", } } /> } modalClass="" onCancel={[Function]} onConfirm={[Function]} show={false} title={ <Memo(MemoizedFormattedMessage) defaultMessage="Remove Membership from the {name} {displayType}?" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_header" values={ Object { "displayType": "team", "name": "Test public-team", } } /> } /> <td> <span className="arrow-icon" /> <span className="name-no-arrow" > Test public-team </span> </td> <td className="type" > <MemoizedFormattedMessage defaultMessage="Team" id="admin.group_settings.group_details.group_teams_and_channels_row.publicTeam" /> </td> <td /> <td className="text-right" > <button className="btn btn-tertiary" data-testid="Test public-team_groupsyncable_remove" onClick={[Function]} type="button" > <MemoizedFormattedMessage defaultMessage="Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove" /> </button> </td> </tr> `; exports[`components/admin_console/group_settings/group_details/GroupTeamsAndChannelsRow should match snapshot, when has children 1`] = ` <tr className="group-teams-and-channels-row has-children" > <ConfirmModal confirmButtonClass="btn btn-primary" confirmButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Yes, Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_button" /> } message={ <Memo(MemoizedFormattedMessage) defaultMessage="Removing this membership will prevent future users in this group from being added to the {name} {displayType}." id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_body" values={ Object { "displayType": "team", "name": "Test team with children", } } /> } modalClass="" onCancel={[Function]} onConfirm={[Function]} show={false} title={ <Memo(MemoizedFormattedMessage) defaultMessage="Remove Membership from the {name} {displayType}?" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_header" values={ Object { "displayType": "team", "name": "Test team with children", } } /> } /> <td> <span className="arrow-icon" > <i className="fa fa-caret-down" onClick={[Function]} /> </span> <span className="" > Test team with children </span> </td> <td className="type" > <MemoizedFormattedMessage defaultMessage="Team" id="admin.group_settings.group_details.group_teams_and_channels_row.publicTeam" /> </td> <td /> <td className="text-right" > <button className="btn btn-tertiary" data-testid="Test team with children_groupsyncable_remove" onClick={[Function]} type="button" > <MemoizedFormattedMessage defaultMessage="Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove" /> </button> </td> </tr> `; exports[`components/admin_console/group_settings/group_details/GroupTeamsAndChannelsRow should match snapshot, when has children and is collapsed 1`] = ` <tr className="group-teams-and-channels-row has-children collapsed" > <ConfirmModal confirmButtonClass="btn btn-primary" confirmButtonText={ <Memo(MemoizedFormattedMessage) defaultMessage="Yes, Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_button" /> } message={ <Memo(MemoizedFormattedMessage) defaultMessage="Removing this membership will prevent future users in this group from being added to the {name} {displayType}." id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_body" values={ Object { "displayType": "team", "name": "Test team with children", } } /> } modalClass="" onCancel={[Function]} onConfirm={[Function]} show={false} title={ <Memo(MemoizedFormattedMessage) defaultMessage="Remove Membership from the {name} {displayType}?" id="admin.group_settings.group_details.group_teams_and_channels_row.remove.confirm_header" values={ Object { "displayType": "team", "name": "Test team with children", } } /> } /> <td> <span className="arrow-icon" > <i className="fa fa-caret-right" onClick={[Function]} /> </span> <span className="" > Test team with children </span> </td> <td className="type" > <MemoizedFormattedMessage defaultMessage="Team" id="admin.group_settings.group_details.group_teams_and_channels_row.publicTeam" /> </td> <td /> <td className="text-right" > <button className="btn btn-tertiary" data-testid="Test team with children_groupsyncable_remove" onClick={[Function]} type="button" > <MemoizedFormattedMessage defaultMessage="Remove" id="admin.group_settings.group_details.group_teams_and_channels_row.remove" /> </button> </td> </tr> `;
1,133
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/__snapshots__/group_users.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/group_settings/group_details/GroupUsers should match snapshot, loaded with data 1`] = ` <div className="group-users" > <div className="group-users--header" > <FormattedMarkdownMessage defaultMessage="AD/LDAP Connector is configured to sync and manage this group and its users. [Click here to view]({siteURL}/admin_console/authentication/ldap)" id="admin.group_settings.group_profile.group_users.ldapConnector" values={ Object { "siteURL": "http://localhost:8065", } } /> </div> <div className="group-users--body" > <div className="group-users-loading " > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> <GroupUsersRow displayName="Name0 Surname0" email="[email protected]" key="id0" lastPictureUpdate={0} userId="id0" username="username0" /> <GroupUsersRow displayName="Name1 Surname1" email="[email protected]" key="id1" lastPictureUpdate={1} userId="id1" username="username1" /> <GroupUsersRow displayName="Name2 Surname2" email="[email protected]" key="id2" lastPictureUpdate={2} userId="id2" username="username2" /> <GroupUsersRow displayName="Name3 Surname3" email="[email protected]" key="id3" lastPictureUpdate={3} userId="id3" username="username3" /> <GroupUsersRow displayName="Name4 Surname4" email="[email protected]" key="id4" lastPictureUpdate={4} userId="id4" username="username4" /> <GroupUsersRow displayName="Name5 Surname5" email="[email protected]" key="id5" lastPictureUpdate={5} userId="id5" username="username5" /> <GroupUsersRow displayName="Name6 Surname6" email="[email protected]" key="id6" lastPictureUpdate={6} userId="id6" username="username6" /> <GroupUsersRow displayName="Name7 Surname7" email="[email protected]" key="id7" lastPictureUpdate={7} userId="id7" username="username7" /> <GroupUsersRow displayName="Name8 Surname8" email="[email protected]" key="id8" lastPictureUpdate={8} userId="id8" username="username8" /> <GroupUsersRow displayName="Name9 Surname9" email="[email protected]" key="id9" lastPictureUpdate={9} userId="id9" username="username9" /> <GroupUsersRow displayName="Name10 Surname10" email="[email protected]" key="id10" lastPictureUpdate={10} userId="id10" username="username10" /> <GroupUsersRow displayName="Name11 Surname11" email="[email protected]" key="id11" lastPictureUpdate={11} userId="id11" username="username11" /> <GroupUsersRow displayName="Name12 Surname12" email="[email protected]" key="id12" lastPictureUpdate={12} userId="id12" username="username12" /> <GroupUsersRow displayName="Name13 Surname13" email="[email protected]" key="id13" lastPictureUpdate={13} userId="id13" username="username13" /> <GroupUsersRow displayName="Name14 Surname14" email="[email protected]" key="id14" lastPictureUpdate={14} userId="id14" username="username14" /> <GroupUsersRow displayName="Name15 Surname15" email="[email protected]" key="id15" lastPictureUpdate={15} userId="id15" username="username15" /> <GroupUsersRow displayName="Name16 Surname16" email="[email protected]" key="id16" lastPictureUpdate={16} userId="id16" username="username16" /> <GroupUsersRow displayName="Name17 Surname17" email="[email protected]" key="id17" lastPictureUpdate={17} userId="id17" username="username17" /> <GroupUsersRow displayName="Name18 Surname18" email="[email protected]" key="id18" lastPictureUpdate={18} userId="id18" username="username18" /> <GroupUsersRow displayName="Name19 Surname19" email="[email protected]" key="id19" lastPictureUpdate={19} userId="id19" username="username19" /> </div> <div className="group-users--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 20, "startCount": 1, "total": 20, } } /> </div> <button className="btn btn-tertiary prev disabled" disabled={true} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/group_details/GroupUsers should match snapshot, loaded with multiple pages 1`] = ` <div className="group-users" > <div className="group-users--header" > <FormattedMarkdownMessage defaultMessage="AD/LDAP Connector is configured to sync and manage this group and its users. [Click here to view]({siteURL}/admin_console/authentication/ldap)" id="admin.group_settings.group_profile.group_users.ldapConnector" values={ Object { "siteURL": "http://localhost:8065", } } /> </div> <div className="group-users--body" > <div className="group-users-loading " > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> <GroupUsersRow displayName="Name0 Surname0" email="[email protected]" key="id0" lastPictureUpdate={0} userId="id0" username="username0" /> <GroupUsersRow displayName="Name1 Surname1" email="[email protected]" key="id1" lastPictureUpdate={1} userId="id1" username="username1" /> <GroupUsersRow displayName="Name2 Surname2" email="[email protected]" key="id2" lastPictureUpdate={2} userId="id2" username="username2" /> <GroupUsersRow displayName="Name3 Surname3" email="[email protected]" key="id3" lastPictureUpdate={3} userId="id3" username="username3" /> <GroupUsersRow displayName="Name4 Surname4" email="[email protected]" key="id4" lastPictureUpdate={4} userId="id4" username="username4" /> <GroupUsersRow displayName="Name5 Surname5" email="[email protected]" key="id5" lastPictureUpdate={5} userId="id5" username="username5" /> <GroupUsersRow displayName="Name6 Surname6" email="[email protected]" key="id6" lastPictureUpdate={6} userId="id6" username="username6" /> <GroupUsersRow displayName="Name7 Surname7" email="[email protected]" key="id7" lastPictureUpdate={7} userId="id7" username="username7" /> <GroupUsersRow displayName="Name8 Surname8" email="[email protected]" key="id8" lastPictureUpdate={8} userId="id8" username="username8" /> <GroupUsersRow displayName="Name9 Surname9" email="[email protected]" key="id9" lastPictureUpdate={9} userId="id9" username="username9" /> <GroupUsersRow displayName="Name10 Surname10" email="[email protected]" key="id10" lastPictureUpdate={10} userId="id10" username="username10" /> <GroupUsersRow displayName="Name11 Surname11" email="[email protected]" key="id11" lastPictureUpdate={11} userId="id11" username="username11" /> <GroupUsersRow displayName="Name12 Surname12" email="[email protected]" key="id12" lastPictureUpdate={12} userId="id12" username="username12" /> <GroupUsersRow displayName="Name13 Surname13" email="[email protected]" key="id13" lastPictureUpdate={13} userId="id13" username="username13" /> <GroupUsersRow displayName="Name14 Surname14" email="[email protected]" key="id14" lastPictureUpdate={14} userId="id14" username="username14" /> <GroupUsersRow displayName="Name15 Surname15" email="[email protected]" key="id15" lastPictureUpdate={15} userId="id15" username="username15" /> <GroupUsersRow displayName="Name16 Surname16" email="[email protected]" key="id16" lastPictureUpdate={16} userId="id16" username="username16" /> <GroupUsersRow displayName="Name17 Surname17" email="[email protected]" key="id17" lastPictureUpdate={17} userId="id17" username="username17" /> <GroupUsersRow displayName="Name18 Surname18" email="[email protected]" key="id18" lastPictureUpdate={18} userId="id18" username="username18" /> <GroupUsersRow displayName="Name19 Surname19" email="[email protected]" key="id19" lastPictureUpdate={19} userId="id19" username="username19" /> </div> <div className="group-users--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 20, "startCount": 1, "total": 55, } } /> </div> <button className="btn btn-tertiary prev disabled" disabled={true} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next " disabled={false} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/group_details/GroupUsers should match snapshot, loaded with multiple pages 2`] = ` <div className="group-users" > <div className="group-users--header" > <FormattedMarkdownMessage defaultMessage="AD/LDAP Connector is configured to sync and manage this group and its users. [Click here to view]({siteURL}/admin_console/authentication/ldap)" id="admin.group_settings.group_profile.group_users.ldapConnector" values={ Object { "siteURL": "http://localhost:8065", } } /> </div> <div className="group-users--body" > <div className="group-users-loading " > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> <GroupUsersRow displayName="Name20 Surname20" email="[email protected]" key="id20" lastPictureUpdate={20} userId="id20" username="username20" /> <GroupUsersRow displayName="Name21 Surname21" email="[email protected]" key="id21" lastPictureUpdate={21} userId="id21" username="username21" /> <GroupUsersRow displayName="Name22 Surname22" email="[email protected]" key="id22" lastPictureUpdate={22} userId="id22" username="username22" /> <GroupUsersRow displayName="Name23 Surname23" email="[email protected]" key="id23" lastPictureUpdate={23} userId="id23" username="username23" /> <GroupUsersRow displayName="Name24 Surname24" email="[email protected]" key="id24" lastPictureUpdate={24} userId="id24" username="username24" /> <GroupUsersRow displayName="Name25 Surname25" email="[email protected]" key="id25" lastPictureUpdate={25} userId="id25" username="username25" /> <GroupUsersRow displayName="Name26 Surname26" email="[email protected]" key="id26" lastPictureUpdate={26} userId="id26" username="username26" /> <GroupUsersRow displayName="Name27 Surname27" email="[email protected]" key="id27" lastPictureUpdate={27} userId="id27" username="username27" /> <GroupUsersRow displayName="Name28 Surname28" email="[email protected]" key="id28" lastPictureUpdate={28} userId="id28" username="username28" /> <GroupUsersRow displayName="Name29 Surname29" email="[email protected]" key="id29" lastPictureUpdate={29} userId="id29" username="username29" /> <GroupUsersRow displayName="Name30 Surname30" email="[email protected]" key="id30" lastPictureUpdate={30} userId="id30" username="username30" /> <GroupUsersRow displayName="Name31 Surname31" email="[email protected]" key="id31" lastPictureUpdate={31} userId="id31" username="username31" /> <GroupUsersRow displayName="Name32 Surname32" email="[email protected]" key="id32" lastPictureUpdate={32} userId="id32" username="username32" /> <GroupUsersRow displayName="Name33 Surname33" email="[email protected]" key="id33" lastPictureUpdate={33} userId="id33" username="username33" /> <GroupUsersRow displayName="Name34 Surname34" email="[email protected]" key="id34" lastPictureUpdate={34} userId="id34" username="username34" /> <GroupUsersRow displayName="Name35 Surname35" email="[email protected]" key="id35" lastPictureUpdate={35} userId="id35" username="username35" /> <GroupUsersRow displayName="Name36 Surname36" email="[email protected]" key="id36" lastPictureUpdate={36} userId="id36" username="username36" /> <GroupUsersRow displayName="Name37 Surname37" email="[email protected]" key="id37" lastPictureUpdate={37} userId="id37" username="username37" /> <GroupUsersRow displayName="Name38 Surname38" email="[email protected]" key="id38" lastPictureUpdate={38} userId="id38" username="username38" /> <GroupUsersRow displayName="Name39 Surname39" email="[email protected]" key="id39" lastPictureUpdate={39} userId="id39" username="username39" /> </div> <div className="group-users--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 40, "startCount": 21, "total": 55, } } /> </div> <button className="btn btn-tertiary prev " disabled={false} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next " disabled={false} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/group_details/GroupUsers should match snapshot, loaded with multiple pages 3`] = ` <div className="group-users" > <div className="group-users--header" > <FormattedMarkdownMessage defaultMessage="AD/LDAP Connector is configured to sync and manage this group and its users. [Click here to view]({siteURL}/admin_console/authentication/ldap)" id="admin.group_settings.group_profile.group_users.ldapConnector" values={ Object { "siteURL": "http://localhost:8065", } } /> </div> <div className="group-users--body" > <div className="group-users-loading " > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> <GroupUsersRow displayName="Name40 Surname40" email="[email protected]" key="id40" lastPictureUpdate={40} userId="id40" username="username40" /> <GroupUsersRow displayName="Name41 Surname41" email="[email protected]" key="id41" lastPictureUpdate={41} userId="id41" username="username41" /> <GroupUsersRow displayName="Name42 Surname42" email="[email protected]" key="id42" lastPictureUpdate={42} userId="id42" username="username42" /> <GroupUsersRow displayName="Name43 Surname43" email="[email protected]" key="id43" lastPictureUpdate={43} userId="id43" username="username43" /> <GroupUsersRow displayName="Name44 Surname44" email="[email protected]" key="id44" lastPictureUpdate={44} userId="id44" username="username44" /> <GroupUsersRow displayName="Name45 Surname45" email="[email protected]" key="id45" lastPictureUpdate={45} userId="id45" username="username45" /> <GroupUsersRow displayName="Name46 Surname46" email="[email protected]" key="id46" lastPictureUpdate={46} userId="id46" username="username46" /> <GroupUsersRow displayName="Name47 Surname47" email="[email protected]" key="id47" lastPictureUpdate={47} userId="id47" username="username47" /> <GroupUsersRow displayName="Name48 Surname48" email="[email protected]" key="id48" lastPictureUpdate={48} userId="id48" username="username48" /> <GroupUsersRow displayName="Name49 Surname49" email="[email protected]" key="id49" lastPictureUpdate={49} userId="id49" username="username49" /> <GroupUsersRow displayName="Name50 Surname50" email="[email protected]" key="id50" lastPictureUpdate={50} userId="id50" username="username50" /> <GroupUsersRow displayName="Name51 Surname51" email="[email protected]" key="id51" lastPictureUpdate={51} userId="id51" username="username51" /> <GroupUsersRow displayName="Name52 Surname52" email="[email protected]" key="id52" lastPictureUpdate={52} userId="id52" username="username52" /> <GroupUsersRow displayName="Name53 Surname53" email="[email protected]" key="id53" lastPictureUpdate={53} userId="id53" username="username53" /> <GroupUsersRow displayName="Name54 Surname54" email="[email protected]" key="id54" lastPictureUpdate={54} userId="id54" username="username54" /> </div> <div className="group-users--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 55, "startCount": 41, "total": 55, } } /> </div> <button className="btn btn-tertiary prev " disabled={false} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/group_details/GroupUsers should match snapshot, loaded with one page 1`] = ` <div className="group-users" > <div className="group-users--header" > <FormattedMarkdownMessage defaultMessage="AD/LDAP Connector is configured to sync and manage this group and its users. [Click here to view]({siteURL}/admin_console/authentication/ldap)" id="admin.group_settings.group_profile.group_users.ldapConnector" values={ Object { "siteURL": "http://localhost:8065", } } /> </div> <div className="group-users--body" > <div className="group-users-loading " > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> <GroupUsersRow displayName="Name0 Surname0" email="[email protected]" key="id0" lastPictureUpdate={0} userId="id0" username="username0" /> <GroupUsersRow displayName="Name1 Surname1" email="[email protected]" key="id1" lastPictureUpdate={1} userId="id1" username="username1" /> <GroupUsersRow displayName="Name2 Surname2" email="[email protected]" key="id2" lastPictureUpdate={2} userId="id2" username="username2" /> <GroupUsersRow displayName="Name3 Surname3" email="[email protected]" key="id3" lastPictureUpdate={3} userId="id3" username="username3" /> <GroupUsersRow displayName="Name4 Surname4" email="[email protected]" key="id4" lastPictureUpdate={4} userId="id4" username="username4" /> <GroupUsersRow displayName="Name5 Surname5" email="[email protected]" key="id5" lastPictureUpdate={5} userId="id5" username="username5" /> <GroupUsersRow displayName="Name6 Surname6" email="[email protected]" key="id6" lastPictureUpdate={6} userId="id6" username="username6" /> <GroupUsersRow displayName="Name7 Surname7" email="[email protected]" key="id7" lastPictureUpdate={7} userId="id7" username="username7" /> <GroupUsersRow displayName="Name8 Surname8" email="[email protected]" key="id8" lastPictureUpdate={8} userId="id8" username="username8" /> <GroupUsersRow displayName="Name9 Surname9" email="[email protected]" key="id9" lastPictureUpdate={9} userId="id9" username="username9" /> <GroupUsersRow displayName="Name10 Surname10" email="[email protected]" key="id10" lastPictureUpdate={10} userId="id10" username="username10" /> <GroupUsersRow displayName="Name11 Surname11" email="[email protected]" key="id11" lastPictureUpdate={11} userId="id11" username="username11" /> <GroupUsersRow displayName="Name12 Surname12" email="[email protected]" key="id12" lastPictureUpdate={12} userId="id12" username="username12" /> <GroupUsersRow displayName="Name13 Surname13" email="[email protected]" key="id13" lastPictureUpdate={13} userId="id13" username="username13" /> <GroupUsersRow displayName="Name14 Surname14" email="[email protected]" key="id14" lastPictureUpdate={14} userId="id14" username="username14" /> <GroupUsersRow displayName="Name15 Surname15" email="[email protected]" key="id15" lastPictureUpdate={15} userId="id15" username="username15" /> <GroupUsersRow displayName="Name16 Surname16" email="[email protected]" key="id16" lastPictureUpdate={16} userId="id16" username="username16" /> <GroupUsersRow displayName="Name17 Surname17" email="[email protected]" key="id17" lastPictureUpdate={17} userId="id17" username="username17" /> <GroupUsersRow displayName="Name18 Surname18" email="[email protected]" key="id18" lastPictureUpdate={18} userId="id18" username="username18" /> <GroupUsersRow displayName="Name19 Surname19" email="[email protected]" key="id19" lastPictureUpdate={19} userId="id19" username="username19" /> </div> <div className="group-users--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 20, "startCount": 1, "total": 20, } } /> </div> <button className="btn btn-tertiary prev disabled" disabled={true} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/group_details/GroupUsers should match snapshot, loaded without data 1`] = ` <div className="group-users" > <div className="group-users--header" > <FormattedMarkdownMessage defaultMessage="AD/LDAP Connector is configured to sync and manage this group and its users. [Click here to view]({siteURL}/admin_console/authentication/ldap)" id="admin.group_settings.group_profile.group_users.ldapConnector" values={ Object { "siteURL": "http://localhost:8065", } } /> </div> <div className="group-users--body" > <div className="group-users-loading " > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> <div className="group-users-empty" > <MemoizedFormattedMessage defaultMessage="No users found" id="admin.group_settings.group_details.group_users.no-users-found" /> </div> </div> <div className="group-users--footer empty" /> </div> `; exports[`components/admin_console/group_settings/group_details/GroupUsers should match snapshot, on loading with data 1`] = ` <div className="group-users" > <div className="group-users--header" > <FormattedMarkdownMessage defaultMessage="AD/LDAP Connector is configured to sync and manage this group and its users. [Click here to view]({siteURL}/admin_console/authentication/ldap)" id="admin.group_settings.group_profile.group_users.ldapConnector" values={ Object { "siteURL": "http://localhost:8065", } } /> </div> <div className="group-users--body" > <div className="group-users-loading active" > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> <GroupUsersRow displayName="Name0 Surname0" email="[email protected]" key="id0" lastPictureUpdate={0} userId="id0" username="username0" /> <GroupUsersRow displayName="Name1 Surname1" email="[email protected]" key="id1" lastPictureUpdate={1} userId="id1" username="username1" /> <GroupUsersRow displayName="Name2 Surname2" email="[email protected]" key="id2" lastPictureUpdate={2} userId="id2" username="username2" /> <GroupUsersRow displayName="Name3 Surname3" email="[email protected]" key="id3" lastPictureUpdate={3} userId="id3" username="username3" /> <GroupUsersRow displayName="Name4 Surname4" email="[email protected]" key="id4" lastPictureUpdate={4} userId="id4" username="username4" /> <GroupUsersRow displayName="Name5 Surname5" email="[email protected]" key="id5" lastPictureUpdate={5} userId="id5" username="username5" /> <GroupUsersRow displayName="Name6 Surname6" email="[email protected]" key="id6" lastPictureUpdate={6} userId="id6" username="username6" /> <GroupUsersRow displayName="Name7 Surname7" email="[email protected]" key="id7" lastPictureUpdate={7} userId="id7" username="username7" /> <GroupUsersRow displayName="Name8 Surname8" email="[email protected]" key="id8" lastPictureUpdate={8} userId="id8" username="username8" /> <GroupUsersRow displayName="Name9 Surname9" email="[email protected]" key="id9" lastPictureUpdate={9} userId="id9" username="username9" /> <GroupUsersRow displayName="Name10 Surname10" email="[email protected]" key="id10" lastPictureUpdate={10} userId="id10" username="username10" /> <GroupUsersRow displayName="Name11 Surname11" email="[email protected]" key="id11" lastPictureUpdate={11} userId="id11" username="username11" /> <GroupUsersRow displayName="Name12 Surname12" email="[email protected]" key="id12" lastPictureUpdate={12} userId="id12" username="username12" /> <GroupUsersRow displayName="Name13 Surname13" email="[email protected]" key="id13" lastPictureUpdate={13} userId="id13" username="username13" /> <GroupUsersRow displayName="Name14 Surname14" email="[email protected]" key="id14" lastPictureUpdate={14} userId="id14" username="username14" /> <GroupUsersRow displayName="Name15 Surname15" email="[email protected]" key="id15" lastPictureUpdate={15} userId="id15" username="username15" /> <GroupUsersRow displayName="Name16 Surname16" email="[email protected]" key="id16" lastPictureUpdate={16} userId="id16" username="username16" /> <GroupUsersRow displayName="Name17 Surname17" email="[email protected]" key="id17" lastPictureUpdate={17} userId="id17" username="username17" /> <GroupUsersRow displayName="Name18 Surname18" email="[email protected]" key="id18" lastPictureUpdate={18} userId="id18" username="username18" /> <GroupUsersRow displayName="Name19 Surname19" email="[email protected]" key="id19" lastPictureUpdate={19} userId="id19" username="username19" /> </div> <div className="group-users--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 20, "startCount": 1, "total": 20, } } /> </div> <button className="btn btn-tertiary prev disabled" disabled={true} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/group_details/GroupUsers should match snapshot, on loading without data 1`] = ` <div className="group-users" > <div className="group-users--header" > <FormattedMarkdownMessage defaultMessage="AD/LDAP Connector is configured to sync and manage this group and its users. [Click here to view]({siteURL}/admin_console/authentication/ldap)" id="admin.group_settings.group_profile.group_users.ldapConnector" values={ Object { "siteURL": "http://localhost:8065", } } /> </div> <div className="group-users--body" > <div className="group-users-loading active" > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> <div className="group-users-empty" > <MemoizedFormattedMessage defaultMessage="No users found" id="admin.group_settings.group_details.group_users.no-users-found" /> </div> </div> <div className="group-users--footer empty" /> </div> `;
1,134
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/group_details/__snapshots__/group_users_row.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/group_settings/group_details/GroupUsersRow should match snapshot 1`] = ` <div className="group-users-row" > <Memo(Avatar) size="lg" url="/api/v4/users/xxxxxxxxxxxxxxxxxxxxxxxxxx/image" username="test" /> <div className="user-data" > <div className="name-row" > <span className="username" > @test </span> - <span className="display-name" > Test display name </span> </div> <div> <span className="email-label" > <MemoizedFormattedMessage defaultMessage="Email:" id="admin.group_settings.group_details.group_users.email" /> </span> <span className="email" > [email protected] </span> </div> </div> </div> `;
1,135
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/groups_list/groups_list.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import GroupsList from 'components/admin_console/group_settings/groups_list/groups_list'; describe('components/admin_console/group_settings/GroupsList.tsx', () => { test('should match snapshot, while loading', () => { const wrapper = shallow<GroupsList>( <GroupsList groups={[]} total={0} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({loading: true}); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with only linked selected', () => { const wrapper = shallow<GroupsList>( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, ]} total={2} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({checked: {test2: true}}); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with only not-linked selected', () => { const wrapper = shallow( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, ]} total={2} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({checked: {test1: true}}); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with mixed types selected', () => { const wrapper = shallow( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, ]} total={2} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({checked: {test1: true, test2: true}}); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, without selection', () => { const wrapper = shallow( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, ]} total={2} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({checked: {}}); expect(wrapper).toMatchSnapshot(); }); test('onCheckToggle must toggle the checked data', () => { const wrapper = shallow<GroupsList>( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, ]} total={2} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); const instance = wrapper.instance(); expect(wrapper.state().checked).toEqual({}); instance.onCheckToggle('test1'); expect(wrapper.state().checked).toEqual({test1: true}); instance.onCheckToggle('test1'); expect(wrapper.state().checked).toEqual({test1: false}); instance.onCheckToggle('test2'); expect(wrapper.state().checked).toEqual({test1: false, test2: true}); instance.onCheckToggle('test2'); expect(wrapper.state().checked).toEqual({test1: false, test2: false}); }); test('linkSelectedGroups must call link for unlinked selected groups', () => { const link = jest.fn(); const wrapper = shallow<GroupsList>( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, ]} total={2} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link, unlink: jest.fn(), }} />, ); const instance = wrapper.instance(); expect(wrapper.state().checked).toEqual({}); instance.onCheckToggle('test1'); instance.onCheckToggle('test2'); instance.linkSelectedGroups(); expect(link).toHaveBeenCalledTimes(1); expect(link).toHaveBeenCalledWith('test1'); }); test('unlinkSelectedGroups must call unlink for linked selected groups', () => { const unlink = jest.fn(); const wrapper = shallow<GroupsList>( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, {primary_key: 'test3', name: 'test3', mattermost_group_id: 'group-id-1', has_syncables: false}, {primary_key: 'test4', name: 'test4'}, ]} total={4} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink, }} />, ); const instance = wrapper.instance(); expect(wrapper.state().checked).toEqual({}); instance.onCheckToggle('test1'); instance.onCheckToggle('test2'); instance.unlinkSelectedGroups(); expect(unlink).toHaveBeenCalledTimes(1); expect(unlink).toHaveBeenCalledWith('test2'); }); test('should match snapshot, without results', () => { const wrapper = shallow( <GroupsList groups={[]} total={0} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({loading: false}); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with results', () => { const wrapper = shallow( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, {primary_key: 'test3', name: 'test3', mattermost_group_id: 'group-id-2', has_syncables: true}, ]} total={3} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({loading: false}); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with results and next and previous', () => { const wrapper = shallow( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, {primary_key: 'test3', name: 'test3', mattermost_group_id: 'group-id-2', has_syncables: true}, {primary_key: 'test4', name: 'test4'}, {primary_key: 'test5', name: 'test5'}, {primary_key: 'test6', name: 'test6'}, {primary_key: 'test7', name: 'test7'}, {primary_key: 'test8', name: 'test8'}, {primary_key: 'test9', name: 'test9'}, {primary_key: 'test10', name: 'test10'}, ]} total={33} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({page: 1, loading: false}); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with results and next', () => { const wrapper = shallow( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, {primary_key: 'test3', name: 'test3', mattermost_group_id: 'group-id-2', has_syncables: true}, {primary_key: 'test4', name: 'test4'}, {primary_key: 'test5', name: 'test5'}, {primary_key: 'test6', name: 'test6'}, {primary_key: 'test7', name: 'test7'}, {primary_key: 'test8', name: 'test8'}, {primary_key: 'test9', name: 'test9'}, {primary_key: 'test10', name: 'test10'}, ]} total={13} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({loading: false}); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot, with results and previous', () => { const wrapper = shallow( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, {primary_key: 'test3', name: 'test3', mattermost_group_id: 'group-id-2', has_syncables: true}, ]} total={13} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({page: 1, loading: false}); expect(wrapper).toMatchSnapshot(); }); test('should change properly the state and call the getLdapGroups, on previousPage when page > 0', async () => { const getLdapGroups = jest.fn().mockReturnValue(Promise.resolve()); const wrapper = shallow<GroupsList>( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, {primary_key: 'test3', name: 'test3', mattermost_group_id: 'group-id-2', has_syncables: true}, {primary_key: 'test4', name: 'test4'}, {primary_key: 'test5', name: 'test5'}, {primary_key: 'test6', name: 'test6'}, {primary_key: 'test7', name: 'test7'}, {primary_key: 'test8', name: 'test8'}, {primary_key: 'test9', name: 'test9'}, {primary_key: 'test10', name: 'test10'}, ]} total={20} actions={{ getLdapGroups, link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({page: 2, checked: {test1: true, test2: true}}); await wrapper.instance().previousPage({preventDefault: jest.fn()}); let state = wrapper.instance().state; expect(state.checked).toEqual({}); expect(state.page).toBe(1); expect(state.loading).toBe(false); await wrapper.instance().previousPage({preventDefault: jest.fn()}); state = wrapper.state(); expect(state.checked).toEqual({}); expect(state.page).toBe(0); expect(state.loading).toBe(false); }); test('should change properly the state and call the getLdapGroups, on previousPage when page == 0', async () => { const getLdapGroups = jest.fn().mockReturnValue(Promise.resolve()); const wrapper = shallow<GroupsList>( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, {primary_key: 'test3', name: 'test3', mattermost_group_id: 'group-id-2', has_syncables: true}, ]} total={3} actions={{ getLdapGroups, link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({page: 0, checked: {test1: true, test2: true}}); await wrapper.instance().previousPage({preventDefault: jest.fn()}); const state = wrapper.instance().state; expect(state.checked).toEqual({}); expect(state.page).toBe(0); expect(state.loading).toBe(false); }); test('should change properly the state and call the getLdapGroups, on nextPage clicked', async () => { const getLdapGroups = jest.fn().mockReturnValue(Promise.resolve()); const wrapper = shallow<GroupsList>( <GroupsList groups={[ {primary_key: 'test1', name: 'test1'}, {primary_key: 'test2', name: 'test2', mattermost_group_id: 'group-id-1', has_syncables: false}, {primary_key: 'test3', name: 'test3', mattermost_group_id: 'group-id-2', has_syncables: true}, {primary_key: 'test4', name: 'test4'}, {primary_key: 'test5', name: 'test5'}, {primary_key: 'test6', name: 'test6'}, {primary_key: 'test7', name: 'test7'}, {primary_key: 'test8', name: 'test8'}, {primary_key: 'test9', name: 'test9'}, {primary_key: 'test10', name: 'test10'}, ]} total={20} actions={{ getLdapGroups, link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({page: 0, checked: {test1: true, test2: true}}); await wrapper.instance().nextPage({preventDefault: jest.fn()}); let state = wrapper.state(); expect(state.checked).toEqual({}); expect(state.page).toBe(1); expect(state.loading).toBe(false); await wrapper.instance().nextPage({preventDefault: jest.fn()}); state = wrapper.state(); expect(state.checked).toEqual({}); expect(state.page).toBe(2); expect(state.loading).toBe(false); }); test('should match snapshot, with filters open', () => { const wrapper = shallow( <GroupsList groups={[]} total={0} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({showFilters: true, filterIsLinked: true, filterIsUnlinked: true}); expect(wrapper).toMatchSnapshot(); }); test('clicking the clear icon clears searchString', () => { const wrapper = shallow<GroupsList>( <GroupsList groups={[]} total={0} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({searchString: 'foo'}); wrapper.find('i.fa-times-circle').first().simulate('click'); expect(wrapper.state().searchString).toEqual(''); }); test('clicking the down arrow opens the filters', () => { const wrapper = shallow<GroupsList>( <GroupsList groups={[]} total={0} actions={{ getLdapGroups: jest.fn().mockReturnValue(Promise.resolve()), link: jest.fn(), unlink: jest.fn(), }} />, ); expect(wrapper.state().showFilters).toEqual(false); wrapper.find('i.fa-caret-down').first().simulate('click'); expect(wrapper.state().showFilters).toEqual(true); }); test('clicking search invokes getLdapGroups', () => { const getLdapGroups = jest.fn().mockReturnValue(Promise.resolve()); const wrapper = shallow<GroupsList>( <GroupsList groups={[]} total={0} actions={{ getLdapGroups, link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({showFilters: true, searchString: 'foo iS:ConfiGuReD is:notlinked'}); expect(wrapper.state().filterIsConfigured).toEqual(false); expect(wrapper.state().filterIsUnlinked).toEqual(false); wrapper.find('a.search-groups-btn').first().simulate('click'); expect(getLdapGroups).toHaveBeenCalledTimes(2); expect(getLdapGroups).toHaveBeenCalledWith(0, 200, {q: 'foo', is_configured: true, is_linked: false}); expect(wrapper.state().filterIsConfigured).toEqual(true); expect(wrapper.state().filterIsUnlinked).toEqual(true); }); test('checking a filter checkbox add the filter to the searchString', () => { const getLdapGroups = jest.fn().mockReturnValue(Promise.resolve()); const wrapper = shallow<GroupsList>( <GroupsList groups={[]} total={0} actions={{ getLdapGroups, link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({showFilters: true, searchString: 'foo'}); wrapper.find('span.filter-check').first().simulate('click'); expect(wrapper.state().searchString).toEqual('foo is:linked'); }); test('unchecking a filter checkbox removes the filter from the searchString', () => { const getLdapGroups = jest.fn().mockReturnValue(Promise.resolve()); const wrapper = shallow<GroupsList>( <GroupsList groups={[]} total={0} actions={{ getLdapGroups, link: jest.fn(), unlink: jest.fn(), }} />, ); wrapper.setState({showFilters: true, searchString: 'foo is:linked', filterIsLinked: true}); wrapper.find('span.filter-check').first().simulate('click'); expect(wrapper.state().searchString).toEqual('foo'); }); });
1,138
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/groups_list
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/group_settings/groups_list/__snapshots__/groups_list.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/group_settings/GroupsList.tsx should match snapshot, while loading 1`] = ` <div className="groups-list" > <div className="groups-list--global-actions" > <div className="group-list-search" > <input onChange={[Function]} onKeyUp={[Function]} placeholder="Search" type="text" value="" /> <SearchIcon aria-hidden="true" className="search__icon" /> <i className="fa fa-times-circle group-filter-action hidden" onClick={[Function]} /> <i className="fa fa-caret-down group-filter-action " onClick={[Function]} /> </div> <div className="group-list-link-unlink" > <button className="btn btn-primary" type="button" > <i className="icon icon-link-variant" /> <MemoizedFormattedMessage defaultMessage="Link Selected Groups" id="admin.group_settings.groups_list.link_selected" /> </button> </div> </div> <div className="groups-list--body" id="groups-list--body" > <div className="groups-list-loading" > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> </div> </div> `; exports[`components/admin_console/group_settings/GroupsList.tsx should match snapshot, with filters open 1`] = ` <div className="groups-list" > <div className="groups-list--global-actions" > <div className="group-list-search" > <input onChange={[Function]} onKeyUp={[Function]} placeholder="Search" type="text" value="" /> <SearchIcon aria-hidden="true" className="search__icon" /> <i className="fa fa-times-circle group-filter-action hidden" onClick={[Function]} /> <i className="fa fa-caret-down group-filter-action hidden" onClick={[Function]} /> </div> <div className="group-search-filters" id="group-filters" onClick={[Function]} > <div className="filter-row" > <span className="filter-check checked" onClick={[Function]} > <CheckboxCheckedIcon /> </span> <span> <MemoizedFormattedMessage defaultMessage="Is Linked" id="admin.group_settings.filters.isLinked" /> </span> </div> <div className="filter-row" > <span className="filter-check checked" onClick={[Function]} > <CheckboxCheckedIcon /> </span> <span> <MemoizedFormattedMessage defaultMessage="Is Not Linked" id="admin.group_settings.filters.isUnlinked" /> </span> </div> <div className="filter-row" > <span className="filter-check " onClick={[Function]} /> <span> <MemoizedFormattedMessage defaultMessage="Is Configured" id="admin.group_settings.filters.isConfigured" /> </span> </div> <div className="filter-row" > <span className="filter-check " onClick={[Function]} /> <span> <MemoizedFormattedMessage defaultMessage="Is Not Configured" id="admin.group_settings.filters.isUnconfigured" /> </span> </div> <a className="btn btn-primary search-groups-btn" onClick={[Function]} > <MemoizedFormattedMessage defaultMessage="Search" id="search_bar.search" /> </a> </div> <div className="group-list-link-unlink" > <button className="btn btn-primary" type="button" > <i className="icon icon-link-variant" /> <MemoizedFormattedMessage defaultMessage="Link Selected Groups" id="admin.group_settings.groups_list.link_selected" /> </button> </div> </div> <div className="groups-list--body" id="groups-list--body" > <div className="groups-list-loading" > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> </div> </div> `; exports[`components/admin_console/group_settings/GroupsList.tsx should match snapshot, with mixed types selected 1`] = ` <div className="groups-list" > <div className="groups-list--global-actions" > <div className="group-list-search" > <input onChange={[Function]} onKeyUp={[Function]} placeholder="Search" type="text" value="" /> <SearchIcon aria-hidden="true" className="search__icon" /> <i className="fa fa-times-circle group-filter-action hidden" onClick={[Function]} /> <i className="fa fa-caret-down group-filter-action " onClick={[Function]} /> </div> <div className="group-list-link-unlink" > <button className="btn btn-primary" onClick={[Function]} type="button" > <i className="icon fa fa-link" /> <MemoizedFormattedMessage defaultMessage="Link Selected Groups" id="admin.group_settings.groups_list.link_selected" /> </button> </div> </div> <div className="groups-list--header" > <div className="group-name" > <MemoizedFormattedMessage defaultMessage="Name" id="admin.group_settings.groups_list.nameHeader" /> </div> <div className="group-content" > <div className="group-description" > <MemoizedFormattedMessage defaultMessage="Mattermost Linking" id="admin.group_settings.groups_list.mappingHeader" /> </div> <div className="group-actions" /> </div> </div> <div className="groups-list--body" id="groups-list--body" > <div className="groups-list-loading" > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> </div> <div className="groups-list--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 2, "startCount": 1, "total": 2, } } /> </div> <button className="btn btn-tertiary prev disabled" disabled={true} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/GroupsList.tsx should match snapshot, with only linked selected 1`] = ` <div className="groups-list" > <div className="groups-list--global-actions" > <div className="group-list-search" > <input onChange={[Function]} onKeyUp={[Function]} placeholder="Search" type="text" value="" /> <SearchIcon aria-hidden="true" className="search__icon" /> <i className="fa fa-times-circle group-filter-action hidden" onClick={[Function]} /> <i className="fa fa-caret-down group-filter-action " onClick={[Function]} /> </div> <div className="group-list-link-unlink" > <button className="btn btn-primary" onClick={[Function]} type="button" > <i className="icon fa fa-unlink" /> <MemoizedFormattedMessage defaultMessage="Unlink Selected Groups" id="admin.group_settings.groups_list.unlink_selected" /> </button> </div> </div> <div className="groups-list--header" > <div className="group-name" > <MemoizedFormattedMessage defaultMessage="Name" id="admin.group_settings.groups_list.nameHeader" /> </div> <div className="group-content" > <div className="group-description" > <MemoizedFormattedMessage defaultMessage="Mattermost Linking" id="admin.group_settings.groups_list.mappingHeader" /> </div> <div className="group-actions" /> </div> </div> <div className="groups-list--body" id="groups-list--body" > <div className="groups-list-loading" > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> </div> <div className="groups-list--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 2, "startCount": 1, "total": 2, } } /> </div> <button className="btn btn-tertiary prev disabled" disabled={true} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/GroupsList.tsx should match snapshot, with only not-linked selected 1`] = ` <div className="groups-list" > <div className="groups-list--global-actions" > <div className="group-list-search" > <input onChange={[Function]} onKeyUp={[Function]} placeholder="Search" type="text" value="" /> <SearchIcon aria-hidden="true" className="search__icon" /> <i className="fa fa-times-circle group-filter-action hidden" onClick={[Function]} /> <i className="fa fa-caret-down group-filter-action " onClick={[Function]} /> </div> <div className="group-list-link-unlink" > <button className="btn btn-primary" onClick={[Function]} type="button" > <i className="icon fa fa-link" /> <MemoizedFormattedMessage defaultMessage="Link Selected Groups" id="admin.group_settings.groups_list.link_selected" /> </button> </div> </div> <div className="groups-list--header" > <div className="group-name" > <MemoizedFormattedMessage defaultMessage="Name" id="admin.group_settings.groups_list.nameHeader" /> </div> <div className="group-content" > <div className="group-description" > <MemoizedFormattedMessage defaultMessage="Mattermost Linking" id="admin.group_settings.groups_list.mappingHeader" /> </div> <div className="group-actions" /> </div> </div> <div className="groups-list--body" id="groups-list--body" > <div className="groups-list-loading" > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> </div> <div className="groups-list--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 2, "startCount": 1, "total": 2, } } /> </div> <button className="btn btn-tertiary prev disabled" disabled={true} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/GroupsList.tsx should match snapshot, with results 1`] = ` <div className="groups-list" > <div className="groups-list--global-actions" > <div className="group-list-search" > <input onChange={[Function]} onKeyUp={[Function]} placeholder="Search" type="text" value="" /> <SearchIcon aria-hidden="true" className="search__icon" /> <i className="fa fa-times-circle group-filter-action hidden" onClick={[Function]} /> <i className="fa fa-caret-down group-filter-action " onClick={[Function]} /> </div> <div className="group-list-link-unlink" > <button className="btn btn-primary" type="button" > <i className="icon icon-link-variant" /> <MemoizedFormattedMessage defaultMessage="Link Selected Groups" id="admin.group_settings.groups_list.link_selected" /> </button> </div> </div> <div className="groups-list--header" > <div className="group-name" > <MemoizedFormattedMessage defaultMessage="Name" id="admin.group_settings.groups_list.nameHeader" /> </div> <div className="group-content" > <div className="group-description" > <MemoizedFormattedMessage defaultMessage="Mattermost Linking" id="admin.group_settings.groups_list.mappingHeader" /> </div> <div className="group-actions" /> </div> </div> <div className="groups-list--body" id="groups-list--body" > <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test1" name="test1" onCheckToggle={[Function]} primary_key="test1" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} has_syncables={false} key="test2" mattermost_group_id="group-id-1" name="test2" onCheckToggle={[Function]} primary_key="test2" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} has_syncables={true} key="test3" mattermost_group_id="group-id-2" name="test3" onCheckToggle={[Function]} primary_key="test3" /> </div> <div className="groups-list--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 3, "startCount": 1, "total": 3, } } /> </div> <button className="btn btn-tertiary prev disabled" disabled={true} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/GroupsList.tsx should match snapshot, with results and next 1`] = ` <div className="groups-list" > <div className="groups-list--global-actions" > <div className="group-list-search" > <input onChange={[Function]} onKeyUp={[Function]} placeholder="Search" type="text" value="" /> <SearchIcon aria-hidden="true" className="search__icon" /> <i className="fa fa-times-circle group-filter-action hidden" onClick={[Function]} /> <i className="fa fa-caret-down group-filter-action " onClick={[Function]} /> </div> <div className="group-list-link-unlink" > <button className="btn btn-primary" type="button" > <i className="icon icon-link-variant" /> <MemoizedFormattedMessage defaultMessage="Link Selected Groups" id="admin.group_settings.groups_list.link_selected" /> </button> </div> </div> <div className="groups-list--header" > <div className="group-name" > <MemoizedFormattedMessage defaultMessage="Name" id="admin.group_settings.groups_list.nameHeader" /> </div> <div className="group-content" > <div className="group-description" > <MemoizedFormattedMessage defaultMessage="Mattermost Linking" id="admin.group_settings.groups_list.mappingHeader" /> </div> <div className="group-actions" /> </div> </div> <div className="groups-list--body" id="groups-list--body" > <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test1" name="test1" onCheckToggle={[Function]} primary_key="test1" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} has_syncables={false} key="test2" mattermost_group_id="group-id-1" name="test2" onCheckToggle={[Function]} primary_key="test2" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} has_syncables={true} key="test3" mattermost_group_id="group-id-2" name="test3" onCheckToggle={[Function]} primary_key="test3" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test4" name="test4" onCheckToggle={[Function]} primary_key="test4" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test5" name="test5" onCheckToggle={[Function]} primary_key="test5" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test6" name="test6" onCheckToggle={[Function]} primary_key="test6" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test7" name="test7" onCheckToggle={[Function]} primary_key="test7" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test8" name="test8" onCheckToggle={[Function]} primary_key="test8" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test9" name="test9" onCheckToggle={[Function]} primary_key="test9" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test10" name="test10" onCheckToggle={[Function]} primary_key="test10" /> </div> <div className="groups-list--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 13, "startCount": 1, "total": 13, } } /> </div> <button className="btn btn-tertiary prev disabled" disabled={true} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/GroupsList.tsx should match snapshot, with results and next and previous 1`] = ` <div className="groups-list" > <div className="groups-list--global-actions" > <div className="group-list-search" > <input onChange={[Function]} onKeyUp={[Function]} placeholder="Search" type="text" value="" /> <SearchIcon aria-hidden="true" className="search__icon" /> <i className="fa fa-times-circle group-filter-action hidden" onClick={[Function]} /> <i className="fa fa-caret-down group-filter-action " onClick={[Function]} /> </div> <div className="group-list-link-unlink" > <button className="btn btn-primary" type="button" > <i className="icon icon-link-variant" /> <MemoizedFormattedMessage defaultMessage="Link Selected Groups" id="admin.group_settings.groups_list.link_selected" /> </button> </div> </div> <div className="groups-list--header" > <div className="group-name" > <MemoizedFormattedMessage defaultMessage="Name" id="admin.group_settings.groups_list.nameHeader" /> </div> <div className="group-content" > <div className="group-description" > <MemoizedFormattedMessage defaultMessage="Mattermost Linking" id="admin.group_settings.groups_list.mappingHeader" /> </div> <div className="group-actions" /> </div> </div> <div className="groups-list--body" id="groups-list--body" > <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test1" name="test1" onCheckToggle={[Function]} primary_key="test1" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} has_syncables={false} key="test2" mattermost_group_id="group-id-1" name="test2" onCheckToggle={[Function]} primary_key="test2" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} has_syncables={true} key="test3" mattermost_group_id="group-id-2" name="test3" onCheckToggle={[Function]} primary_key="test3" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test4" name="test4" onCheckToggle={[Function]} primary_key="test4" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test5" name="test5" onCheckToggle={[Function]} primary_key="test5" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test6" name="test6" onCheckToggle={[Function]} primary_key="test6" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test7" name="test7" onCheckToggle={[Function]} primary_key="test7" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test8" name="test8" onCheckToggle={[Function]} primary_key="test8" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test9" name="test9" onCheckToggle={[Function]} primary_key="test9" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test10" name="test10" onCheckToggle={[Function]} primary_key="test10" /> </div> <div className="groups-list--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 33, "startCount": 201, "total": 33, } } /> </div> <button className="btn btn-tertiary prev " disabled={false} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/GroupsList.tsx should match snapshot, with results and previous 1`] = ` <div className="groups-list" > <div className="groups-list--global-actions" > <div className="group-list-search" > <input onChange={[Function]} onKeyUp={[Function]} placeholder="Search" type="text" value="" /> <SearchIcon aria-hidden="true" className="search__icon" /> <i className="fa fa-times-circle group-filter-action hidden" onClick={[Function]} /> <i className="fa fa-caret-down group-filter-action " onClick={[Function]} /> </div> <div className="group-list-link-unlink" > <button className="btn btn-primary" type="button" > <i className="icon icon-link-variant" /> <MemoizedFormattedMessage defaultMessage="Link Selected Groups" id="admin.group_settings.groups_list.link_selected" /> </button> </div> </div> <div className="groups-list--header" > <div className="group-name" > <MemoizedFormattedMessage defaultMessage="Name" id="admin.group_settings.groups_list.nameHeader" /> </div> <div className="group-content" > <div className="group-description" > <MemoizedFormattedMessage defaultMessage="Mattermost Linking" id="admin.group_settings.groups_list.mappingHeader" /> </div> <div className="group-actions" /> </div> </div> <div className="groups-list--body" id="groups-list--body" > <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} key="test1" name="test1" onCheckToggle={[Function]} primary_key="test1" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} has_syncables={false} key="test2" mattermost_group_id="group-id-1" name="test2" onCheckToggle={[Function]} primary_key="test2" /> <GroupRow actions={ Object { "link": [MockFunction], "unlink": [MockFunction], } } checked={false} has_syncables={true} key="test3" mattermost_group_id="group-id-2" name="test3" onCheckToggle={[Function]} primary_key="test3" /> </div> <div className="groups-list--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 13, "startCount": 201, "total": 13, } } /> </div> <button className="btn btn-tertiary prev " disabled={false} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `; exports[`components/admin_console/group_settings/GroupsList.tsx should match snapshot, without results 1`] = ` <div className="groups-list" > <div className="groups-list--global-actions" > <div className="group-list-search" > <input onChange={[Function]} onKeyUp={[Function]} placeholder="Search" type="text" value="" /> <SearchIcon aria-hidden="true" className="search__icon" /> <i className="fa fa-times-circle group-filter-action hidden" onClick={[Function]} /> <i className="fa fa-caret-down group-filter-action " onClick={[Function]} /> </div> <div className="group-list-link-unlink" > <button className="btn btn-primary" type="button" > <i className="icon icon-link-variant" /> <MemoizedFormattedMessage defaultMessage="Link Selected Groups" id="admin.group_settings.groups_list.link_selected" /> </button> </div> </div> <div className="groups-list--body" id="groups-list--body" > <div className="groups-list-empty" > <MemoizedFormattedMessage defaultMessage="No groups found" id="admin.group_settings.groups_list.no_groups_found" /> </div> </div> </div> `; exports[`components/admin_console/group_settings/GroupsList.tsx should match snapshot, without selection 1`] = ` <div className="groups-list" > <div className="groups-list--global-actions" > <div className="group-list-search" > <input onChange={[Function]} onKeyUp={[Function]} placeholder="Search" type="text" value="" /> <SearchIcon aria-hidden="true" className="search__icon" /> <i className="fa fa-times-circle group-filter-action hidden" onClick={[Function]} /> <i className="fa fa-caret-down group-filter-action " onClick={[Function]} /> </div> <div className="group-list-link-unlink" > <button className="btn btn-primary" type="button" > <i className="icon icon-link-variant" /> <MemoizedFormattedMessage defaultMessage="Link Selected Groups" id="admin.group_settings.groups_list.link_selected" /> </button> </div> </div> <div className="groups-list--header" > <div className="group-name" > <MemoizedFormattedMessage defaultMessage="Name" id="admin.group_settings.groups_list.nameHeader" /> </div> <div className="group-content" > <div className="group-description" > <MemoizedFormattedMessage defaultMessage="Mattermost Linking" id="admin.group_settings.groups_list.mappingHeader" /> </div> <div className="group-actions" /> </div> </div> <div className="groups-list--body" id="groups-list--body" > <div className="groups-list-loading" > <i className="fa fa-spinner fa-pulse fa-2x" /> </div> </div> <div className="groups-list--footer" > <div className="counter" > <MemoizedFormattedMessage defaultMessage="{startCount, number} - {endCount, number} of {total, number}" id="admin.group_settings.groups_list.paginatorCount" values={ Object { "endCount": 2, "startCount": 1, "total": 2, } } /> </div> <button className="btn btn-tertiary prev disabled" disabled={true} onClick={[Function]} type="button" > <Memo(PreviousIcon) /> </button> <button className="btn btn-tertiary next disabled" disabled={true} onClick={[Function]} type="button" > <Memo(NextIcon) /> </button> </div> </div> `;
1,140
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/ip_filtering/add_edit_ip_filter_modal.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {fireEvent, waitFor} from '@testing-library/react'; import React from 'react'; import type {AllowedIPRange} from '@mattermost/types/config'; import {renderWithContext} from 'tests/react_testing_utils'; import IPFilteringAddOrEditModal from './add_edit_ip_filter_modal'; jest.mock('components/external_link', () => { return jest.fn().mockImplementation(({children, ...props}) => { return <a {...props}>{children}</a>; }); }); describe('IPFilteringAddOrEditModal', () => { const onExited = jest.fn(); const onSave = jest.fn(); const existingRange: AllowedIPRange = { cidr_block: '192.168.0.0/16', description: 'Test IP Filter', enabled: true, owner_id: '', }; const currentIP = '192.168.0.1'; const baseProps = { onExited, onSave, existingRange, currentIP, }; test('renders the modal with the correct title when an existingRange is provided', () => { const {getByText} = renderWithContext( <IPFilteringAddOrEditModal {...baseProps} />, ); expect(getByText('Edit IP Filter')).toBeInTheDocument(); }); test('renders the modal with the correct title when an existingRange is omitted (ie, Add Modal)', () => { const {getByText} = renderWithContext( <IPFilteringAddOrEditModal {...baseProps} existingRange={undefined} />, ); expect(getByText('Add IP Filter')).toBeInTheDocument(); }); test('renders the modal with the correct inputs and values', () => { const {getByLabelText} = renderWithContext( <IPFilteringAddOrEditModal {...baseProps} />, ); expect(getByLabelText('Enter a name for this rule')).toHaveValue('Test IP Filter'); expect(getByLabelText('Enter IP Range')).toHaveValue('192.168.0.0/16'); }); test('calls the onSave function with the correct values when the Save button is clicked', async () => { const {getByLabelText, getByTestId} = renderWithContext( <IPFilteringAddOrEditModal {...baseProps} />, ); fireEvent.change(getByLabelText('Enter a name for this rule'), {target: {value: 'Test IP Filter 2'}}); fireEvent.change(getByLabelText('Enter IP Range'), {target: {value: '10.0.0.0/8'}}); fireEvent.click(getByTestId('save-add-edit-button')); await waitFor(() => { expect(onSave).toHaveBeenCalledWith({ cidr_block: '10.0.0.0/8', description: 'Test IP Filter 2', enabled: true, owner_id: '', }, existingRange); expect(onExited).toHaveBeenCalled(); }); }); test('calls the onSave function with the correct values when the Save button is clicked for a new IP filter', async () => { const {getByLabelText, getByTestId} = renderWithContext( <IPFilteringAddOrEditModal {...baseProps} existingRange={undefined} />, ); fireEvent.change(getByLabelText('Enter a name for this rule'), {target: {value: 'Test IP Filter 2'}}); fireEvent.change(getByLabelText('Enter IP Range'), {target: {value: '10.0.0.0/8'}}); fireEvent.click(getByTestId('save-add-edit-button')); await waitFor(() => { expect(onSave).toHaveBeenCalledWith({ cidr_block: '10.0.0.0/8', description: 'Test IP Filter 2', enabled: true, owner_id: '', }); expect(onExited).toHaveBeenCalled(); }); }); test('displays an error message when an invalid CIDR is entered', async () => { const {getByLabelText, getByTestId, getByText} = renderWithContext( <IPFilteringAddOrEditModal {...baseProps} />, ); fireEvent.change(getByLabelText('Enter IP Range'), {target: {value: 'invalid-cidr'}}); fireEvent.blur(getByLabelText('Enter IP Range')); fireEvent.click(getByTestId('save-add-edit-button')); await waitFor(() => { expect(getByText('Invalid CIDR address range')).toBeInTheDocument(); expect(onSave).not.toHaveBeenCalled(); expect(onExited).not.toHaveBeenCalled(); }); }); test('disables the Save button when an invalid CIDR is entered', () => { const {getByLabelText, getByTestId} = renderWithContext( <IPFilteringAddOrEditModal {...baseProps} />, ); fireEvent.change(getByLabelText('Enter IP Range'), {target: {value: 'invalid-cidr'}}); fireEvent.blur(getByLabelText('Enter IP Range')); expect(getByTestId('save-add-edit-button')).toBeDisabled(); }); });
1,143
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/ip_filtering/delete_confirmation.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {render, fireEvent, waitFor} from '@testing-library/react'; import React from 'react'; import DeleteConfirmationModal from './delete_confirmation'; describe('DeleteConfirmationModal', () => { const onExited = jest.fn(); const onConfirm = jest.fn(); const filterToDelete = { cidr_block: '192.168.0.0/16', description: 'Test IP Filter', enabled: true, owner_id: '', }; const baseProps = { onExited, onConfirm, filterToDelete, }; test('renders the modal with the correct title', () => { const {getByText} = render( <DeleteConfirmationModal {...baseProps} />, ); expect(getByText('Delete IP Filter')).toBeInTheDocument(); }); test('renders the modal with the correct filter name in description', () => { const {getByText} = render( <DeleteConfirmationModal {...baseProps} />, ); expect(getByText('Test IP Filter')).toBeInTheDocument(); }); test('calls the onClose function when the Cancel button is clicked', () => { const {getByText} = render( <DeleteConfirmationModal {...baseProps} />, ); fireEvent.click(getByText('Cancel')); expect(onExited).toHaveBeenCalled(); expect(onConfirm).not.toHaveBeenCalled(); }); test('calls the onConfirm function with the correct filter when the Delete filter button is clicked', async () => { const {getByText} = render( <DeleteConfirmationModal {...baseProps} />, ); fireEvent.click(getByText('Delete filter')); await waitFor(() => { expect(onConfirm).toHaveBeenCalledWith(filterToDelete); }); }); });
1,145
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/ip_filtering/enable_section.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {screen, fireEvent} from '@testing-library/react'; import React from 'react'; import {renderWithContext} from 'tests/react_testing_utils'; import EnableSectionContent from './enable_section'; jest.mock('components/external_link', () => { return jest.fn().mockImplementation(({children, ...props}) => { return <a {...props}>{children}</a>; }); }); describe('EnableSectionContent', () => { const filterToggle = true; const setFilterToggle = jest.fn(); const baseProps = { filterToggle, setFilterToggle, }; test('renders the component', () => { renderWithContext( <EnableSectionContent {...baseProps} />, ); expect(screen.getByText('Enable IP Filtering')).toBeInTheDocument(); expect(screen.getByText('Limit access to your workspace by IP address.')).toBeInTheDocument(); expect(screen.getByTestId('filterToggle-button')).toBeInTheDocument(); expect(screen.getByRole('button', {pressed: true})).toBeInTheDocument(); }); test('clicking the toggle calls setFilterToggle', () => { renderWithContext( <EnableSectionContent {...baseProps} />, ); fireEvent.click(screen.getByTestId('filterToggle-button')); expect(setFilterToggle).toHaveBeenCalledTimes(1); expect(setFilterToggle).toHaveBeenCalledWith(false); }); test('renders the component, with toggle not pressed if filterToggle is false', () => { renderWithContext( <EnableSectionContent {...baseProps} filterToggle={false} />, ); expect(screen.getByText('Enable IP Filtering')).toBeInTheDocument(); expect(screen.getByText('Limit access to your workspace by IP address.')).toBeInTheDocument(); expect(screen.getByTestId('filterToggle-button')).toBeInTheDocument(); expect(screen.getByRole('button', {pressed: false})).toBeInTheDocument(); }); });
1,149
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/ip_filtering/ip_filtering.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {render, fireEvent, waitFor, screen} from '@testing-library/react'; import React from 'react'; import {IntlProvider} from 'react-intl'; import {Provider} from 'react-redux'; import {BrowserRouter as Router} from 'react-router-dom'; import type {AllowedIPRange, FetchIPResponse} from '@mattermost/types/config'; import {Client4} from 'mattermost-redux/client'; import configureStore from 'store'; import ModalController from 'components/modal_controller'; import IPFiltering from './index'; jest.mock('mattermost-redux/client'); describe('IPFiltering', () => { const ipFilters = [ { cidr_block: '10.0.0.0/8', description: 'Test IP Filter', enabled: true, }, ] as AllowedIPRange[]; const intlProviderProps = { defaultLocale: 'en', locale: 'en', }; const currentIP = '10.0.0.1'; const applyIPFiltersMock = jest.fn(() => Promise.resolve(ipFilters)); const getIPFiltersMock = jest.fn(() => Promise.resolve(ipFilters)); const getCurrentIPMock = jest.fn(() => Promise.resolve({ip: currentIP} as FetchIPResponse)); beforeEach(() => { Client4.applyIPFilters = applyIPFiltersMock; Client4.getIPFilters = getIPFiltersMock; Client4.getCurrentIP = getCurrentIPMock; }); const mockedStore = configureStore({ entities: { users: { currentUserId: 'current_user_id', }, general: { config: {}, license: {}, }, }, views: { admin: { navigationBlock: { blocked: false, }, }, }, }); const wrapWithIntlProviderAndStore = (component: JSX.Element) => ( <Router> <IntlProvider {...intlProviderProps}> <Provider store={mockedStore} > <ModalController/> {component} </Provider> </IntlProvider> </Router> ); test('renders the IP Filtering page', async () => { const {getByText} = render(wrapWithIntlProviderAndStore(<IPFiltering/>)); expect(getByText('IP Filtering')).toBeInTheDocument(); expect(getByText('Enable IP Filtering')).toBeInTheDocument(); await waitFor(() => { expect(getByText('Add Filter')).toBeInTheDocument(); expect(getByText('Test IP Filter')).toBeInTheDocument(); expect(getByText('10.0.0.0/8')).toBeInTheDocument(); }); expect(getByText('Save')).toBeInTheDocument(); }); test('disables IP Filtering when the toggle is turned off', async () => { render(wrapWithIntlProviderAndStore(<IPFiltering/>)); await waitFor(() => { expect(screen.getByTestId('filterToggle-button')).toBeInTheDocument(); expect(screen.getByRole('button', {pressed: true})).toBeInTheDocument(); }); fireEvent.click(screen.getByTestId('filterToggle-button')); await waitFor(() => { expect(screen.getByRole('button', {pressed: false})).toBeInTheDocument(); }); }); test('adds a new IP filter when the "Add IP Filter" button is clicked', async () => { const {getByLabelText, getByText} = render(wrapWithIntlProviderAndStore(<IPFiltering/>)); await waitFor(() => { expect(getByText('Add Filter')).toBeInTheDocument(); }); fireEvent.click(getByText('Add Filter')); const descriptionInput = getByLabelText('Enter a name for this rule'); const cidrInput = getByLabelText('Enter IP Range'); const saveButton = screen.getByTestId('save-add-edit-button'); fireEvent.change(cidrInput, {target: {value: '192.168.0.0/16'}}); fireEvent.change(descriptionInput, {target: {value: 'Test IP Filter 2'}}); fireEvent.click(saveButton); await waitFor(() => { expect(getByText('Test IP Filter 2')).toBeInTheDocument(); expect(getByText('192.168.0.0/16')).toBeInTheDocument(); }); }); test('edits an existing IP filter when the "Edit" button is clicked', async () => { const {getByLabelText, getByText, queryByText} = render(wrapWithIntlProviderAndStore(<IPFiltering/>)); await waitFor(() => { expect(getByText('Test IP Filter')).toBeInTheDocument(); }); fireEvent.mouseEnter(screen.getByText('Test IP Filter')); fireEvent.click(screen.getByRole('button', { name: /Edit/i, })); const descriptionInput = getByLabelText('Enter a name for this rule'); const cidrInput = getByLabelText('Enter IP Range'); const saveButton = screen.getByTestId('save-add-edit-button'); fireEvent.change(cidrInput, {target: {value: '192.168.0.0/16'}}); fireEvent.change(descriptionInput, {target: {value: 'zzzzzfilter'}}); fireEvent.click(saveButton); await waitFor(() => { expect(getByText('zzzzzfilter')).toBeInTheDocument(); expect(getByText('192.168.0.0/16')).toBeInTheDocument(); // ensure that the old description is gone, because we've now changed it expect(queryByText('Test IP Filter')).toBeNull(); }); }); test('deletes an existing IP filter when the "Delete" button is clicked', async () => { const {getByText, queryByText} = render(wrapWithIntlProviderAndStore(<IPFiltering/>)); await waitFor(() => { expect(getByText('Test IP Filter')).toBeInTheDocument(); }); fireEvent.mouseEnter(screen.getByText('Test IP Filter')); fireEvent.click(screen.getByRole('button', { name: /Delete/i, })); const confirmButton = getByText('Delete filter'); fireEvent.click(confirmButton); await waitFor(() => { expect(queryByText('Test IP Filter')).not.toBeInTheDocument(); }); }); test('saves changes when the "Save" button is clicked', async () => { const {getByText, queryByText} = render(wrapWithIntlProviderAndStore(<IPFiltering/>)); await waitFor(() => { expect(screen.getByTestId('filterToggle-button')).toBeInTheDocument(); expect(screen.getByRole('button', {pressed: true})).toBeInTheDocument(); }); fireEvent.click(screen.getByTestId('filterToggle-button')); await waitFor(() => { expect(screen.getByRole('button', {pressed: false})).toBeInTheDocument(); }); await waitFor(() => { expect(queryByText('Test IP Filter')).not.toBeInTheDocument(); }); fireEvent.click(getByText('Save')); fireEvent.click(screen.getByTestId('save-confirmation-button')); await waitFor(() => { expect(applyIPFiltersMock).toHaveBeenCalledTimes(1); }); }); });
1,150
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/ip_filtering/ip_filtering_utils.test.ts
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import type {AllowedIPRange} from '@mattermost/types/config'; import {isIPAddressInRanges, validateCIDR} from './ip_filtering_utils'; describe('isIPAddressInRanges', () => { const allowedIPRanges = [ { cidr_block: '192.168.0.0/24', description: 'Test Filter', }, { cidr_block: '10.1.0.0/16', description: 'Test Filter 2', }, { cidr_block: '172.16.0.0/12', description: 'Test Filter 3', }, { cidr_block: '2001:db8::/32', description: 'Test Filter 4', }, { cidr_block: 'fe80::/10', description: 'Test Filter 5', }, ] as AllowedIPRange[]; test('returns true if the IPv4 address is within an allowed IP range', () => { expect(isIPAddressInRanges('192.168.0.1', allowedIPRanges)).toBe(true); expect(isIPAddressInRanges('10.1.0.1', allowedIPRanges)).toBe(true); expect(isIPAddressInRanges('172.16.0.1', allowedIPRanges)).toBe(true); expect(isIPAddressInRanges('172.31.255.255', allowedIPRanges)).toBe(true); }); test('returns false if the IPv4 address is not within an allowed IP range', () => { expect(isIPAddressInRanges('192.168.1.1', allowedIPRanges)).toBe(false); expect(isIPAddressInRanges('172.15.255.255', allowedIPRanges)).toBe(false); expect(isIPAddressInRanges('172.32.0.1', allowedIPRanges)).toBe(false); expect(isIPAddressInRanges('10.0.55.8', allowedIPRanges)).toBe(false); }); test('returns true if the IPv6 address is within an allowed IP range', () => { expect(isIPAddressInRanges('2001:db8::1', allowedIPRanges)).toBe(true); expect(isIPAddressInRanges('fe80::1', allowedIPRanges)).toBe(true); expect(isIPAddressInRanges('2001:db8:1234:5678::abcd', allowedIPRanges)).toBe(true); }); test('returns false if the IPv6 address is not within an allowed IP range', () => { expect(isIPAddressInRanges('3001::1234:5678:abcd:ef02', allowedIPRanges)).toBe(false); expect(isIPAddressInRanges('ff80:db8:1234:5678::abce', allowedIPRanges)).toBe(false); }); }); describe('validateCIDR', () => { const goodRanges = [ { cidr_block: '192.168.0.0/24', description: 'Test Filter', }, { cidr_block: '10.1.0.0/16', description: 'Test Filter 2', }, { cidr_block: '172.16.0.0/12', description: 'Test Filter 3', }, { cidr_block: '2001:db8::/32', description: 'Test Filter 4', }, { cidr_block: 'fe80::/10', description: 'Test Filter 5', }, ] as AllowedIPRange[]; const badRanges = [ { cidr_block: 'fe80::1234:5678:abcd:ef01:/8', }, ]; test('returns true for valid CIDR blocks', () => { for (const allowedIPRange of goodRanges) { expect(validateCIDR(allowedIPRange.cidr_block)).toBeTruthy(); } }); test('returns false for invalid CIDR blocks', () => { for (const allowedIPRange of badRanges) { expect(validateCIDR(allowedIPRange.cidr_block)).not.toBeTruthy(); } }); });
1,153
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/ip_filtering/save_confirmation_modal.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {fireEvent} from '@testing-library/react'; import React from 'react'; import {renderWithContext} from 'tests/react_testing_utils'; import SaveConfirmationModal from './save_confirmation_modal'; jest.mock('components/external_link', () => { return jest.fn().mockImplementation(({children, ...props}) => { return <a {...props}>{children}</a>; }); }); describe('SaveConfirmationModal', () => { const onExitedMock = jest.fn(); const onConfirmMock = jest.fn(); const title = 'Test Title'; const subtitle = 'Test Subtitle'; const buttonText = 'Test Button Text'; const baseProps = { onExited: onExitedMock, onConfirm: onConfirmMock, title, subtitle, buttonText, }; test('renders the title and subtitle', () => { const {getByText} = renderWithContext( <SaveConfirmationModal {...baseProps} />, ); expect(getByText(title)).toBeInTheDocument(); expect(getByText(subtitle)).toBeInTheDocument(); }); test('renders the disclaimer if includeDisclaimer is true', () => { const {getByText} = renderWithContext( <SaveConfirmationModal {...baseProps} includeDisclaimer={true} />, ); expect(getByText('Using the Customer Portal to restore access')).toBeInTheDocument(); }); test('calls onClose when the cancel button is clicked', () => { const {getByText} = renderWithContext( <SaveConfirmationModal {...baseProps} />, ); fireEvent.click(getByText('Cancel')); expect(onExitedMock).toHaveBeenCalledTimes(1); }); test('calls onConfirm when the confirm button is clicked', () => { const {getByText} = renderWithContext( <SaveConfirmationModal {...baseProps} />, ); fireEvent.click(getByText(buttonText)); expect(onConfirmMock).toHaveBeenCalledTimes(1); }); });
1,155
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/ip_filtering
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/ip_filtering/edit_section/edit_section.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {screen, fireEvent} from '@testing-library/react'; import React from 'react'; import type {AllowedIPRange} from '@mattermost/types/config'; import {renderWithContext} from 'tests/react_testing_utils'; import EditSection from './'; describe('EditSection', () => { const ipFilters = [ { cidr_block: '192.168.0.0/24', description: 'Test Filter', }, ] as AllowedIPRange[]; const currentUsersIP = '192.168.0.1'; const setShowAddModal = jest.fn(); const setEditFilter = jest.fn(); const handleConfirmDeleteFilter = jest.fn(); const currentIPIsInRange = true; const baseProps = { ipFilters, currentUsersIP, setShowAddModal, setEditFilter, handleConfirmDeleteFilter, currentIPIsInRange, }; test('renders the component', () => { renderWithContext( <EditSection {...baseProps} />, ); expect(screen.getByText('Allowed IP Addresses')).toBeInTheDocument(); expect(screen.getByText('Create rules to allow access to the workspace for specified IP addresses only.')).toBeInTheDocument(); expect(screen.getByText('If no rules are added, all IP addresses will be allowed.')).toBeInTheDocument(); expect(screen.getByText('Add Filter')).toBeInTheDocument(); expect(screen.getByText('Filter Name')).toBeInTheDocument(); expect(screen.getByText('IP Address Range')).toBeInTheDocument(); expect(screen.getByText('Test Filter')).toBeInTheDocument(); expect(screen.getByText('192.168.0.0/24')).toBeInTheDocument(); }); test('clicking the Add Filter button calls setShowAddModal', () => { renderWithContext( <EditSection {...baseProps} />, ); fireEvent.click(screen.getByText('Add Filter')); expect(setShowAddModal).toHaveBeenCalledTimes(1); expect(setShowAddModal).toHaveBeenCalledWith(true); }); test('clicking the Edit button calls setEditFilter', () => { renderWithContext( <EditSection {...baseProps} />, ); fireEvent.mouseEnter(screen.getByText('Test Filter')); fireEvent.click(screen.getByRole('button', { name: /Edit/i, })); expect(setEditFilter).toHaveBeenCalledTimes(1); expect(setEditFilter).toHaveBeenCalledWith(ipFilters[0]); }); test('clicking the Delete button calls handleConfirmDeleteFilter', () => { renderWithContext( <EditSection {...baseProps} />, ); fireEvent.mouseEnter(screen.getByText('Test Filter')); fireEvent.click(screen.getByRole('button', { name: /Delete/i, })); expect(handleConfirmDeleteFilter).toHaveBeenCalledTimes(1); expect(handleConfirmDeleteFilter).toHaveBeenCalledWith(ipFilters[0]); }); test('displays an error panel if current IP is not in range', () => { renderWithContext( <EditSection {...baseProps} currentUsersIP='192.168.1.1' currentIPIsInRange={false} />, ); expect(screen.getByText('Your IP address 192.168.1.1 is not included in your allowed IP address rules.')).toBeInTheDocument(); expect(screen.getByText('Include your IP address in at least one of the rules below to continue.')).toBeInTheDocument(); expect(screen.getByText('Add your IP address')).toBeInTheDocument(); }); test('displays a message if no filters are added', () => { renderWithContext( <EditSection {...baseProps} ipFilters={[]} />, ); expect(screen.getByText('No IP filtering rules added')).toBeInTheDocument(); expect(screen.getByText('Add a filter')).toBeInTheDocument(); }); });
1,170
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/jobs/table.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import React from 'react'; import {FormattedMessage} from 'react-intl'; import JobCancelButton from './job_cancel_button'; import JobTable from './table'; import type {Props} from './table'; describe('components/admin_console/jobs/table', () => { const createJobButtonText = ( <FormattedMessage id='admin.complianceExport.createJob.title' defaultMessage='Run Compliance Export Job Now' /> ); const createJobHelpText = ( <FormattedMessage id='admin.complianceExport.createJob.help' defaultMessage='Initiates a Compliance Export job immediately.' /> ); const cancelJob = jest.fn(() => Promise.resolve({})); const createJob = jest.fn(() => Promise.resolve({})); const getJobsByType = jest.fn(() => Promise.resolve({})); const baseProps: Props = { createJobButtonText, createJobHelpText, disabled: false, actions: { cancelJob, createJob, getJobsByType, }, jobType: 'data_retention', jobs: [{ create_at: 1540834294674, last_activity_at: 1540834294674, id: '1231', status: 'success', type: 'data_retention', priority: 0, start_at: 0, progress: 0, data: '', }, { create_at: 1540834294674, last_activity_at: 1540834294674, id: '1232', status: 'pending', type: 'data_retention', priority: 0, start_at: 0, progress: 0, data: '', }, { create_at: 1540834294674, last_activity_at: 1540834294674, id: '1233', status: 'in_progress', type: 'data_retention', priority: 0, start_at: 0, progress: 0, data: '', }, { create_at: 1540834294674, last_activity_at: 1540834294674, id: '1234', status: 'cancel_requested', type: 'data_retention', priority: 0, start_at: 0, progress: 0, data: '', }, { create_at: 1540834294674, last_activity_at: 1540834294674, id: '1235', status: 'canceled', type: 'data_retention', priority: 0, start_at: 0, progress: 0, data: '', }, { create_at: 1540834294674, last_activity_at: 1540834294674, id: '1236', status: 'error', type: 'data_retention', priority: 0, start_at: 0, progress: 0, data: '', }, { create_at: 1540834294674, last_activity_at: 1540834294674, id: '1236', status: 'warning', type: 'data_retention', priority: 0, start_at: 0, progress: 0, data: '', }], }; test('should call create job func', () => { const wrapper = shallow( <JobTable {...baseProps}/>, ); wrapper.find('.job-table__create-button > div > .btn-tertiary').simulate('click', {preventDefault: jest.fn()}); expect(createJob).toHaveBeenCalledTimes(1); }); test('should call cancel job func', () => { const wrapper = shallow( <JobTable {...baseProps}/>, ); wrapper.find(JobCancelButton).first().simulate('click', {preventDefault: jest.fn(), currentTarget: {getAttribute: () => '1234'}}); expect(cancelJob).toHaveBeenCalledTimes(1); }); test('files column should show', () => { const cols = [ {header: ''}, {header: 'Status'}, {header: 'Files'}, {header: 'Finish Time'}, {header: 'Run Time'}, {header: 'Details'}, ]; const wrapper = shallow( <JobTable {...baseProps} jobType='message_export' downloadExportResults={true} />, ); // There should be ONLY 1 table element const table = wrapper.find('table'); expect(table).toHaveLength(1); // The table should have ONLY 1 thead element const thead = table.find('thead'); expect(thead).toHaveLength(1); // The number of th tags should be equal to number of columns const headers = thead.find('th'); expect(headers).toHaveLength(cols.length); }); test('files column should not show', () => { const cols = [ {header: ''}, {header: 'Status'}, {header: 'Finish Time'}, {header: 'Run Time'}, {header: 'Details'}, ]; const wrapper = shallow( <JobTable {...baseProps} downloadExportResults={false} />, ); // There should be ONLY 1 table element const table = wrapper.find('table'); expect(table).toHaveLength(1); // The table should have ONLY 1 thead element const thead = table.find('thead'); expect(thead).toHaveLength(1); // The number of th tags should be equal to number of columns const headers = thead.find('th'); expect(headers).toHaveLength(cols.length); }); test('hide create job button', () => { const wrapper = shallow( <JobTable {...baseProps} hideJobCreateButton={true} />, ); const button = wrapper.find('button.btn-default'); expect(button).toHaveLength(0); }); test('add custom class', () => { const wrapper = shallow( <JobTable {...baseProps} className={'job-table__data-retention'} />, ); const element = wrapper.find('.job-table__data-retention'); expect(element).toHaveLength(1); }); });
1,174
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/license_settings/license_settings.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {shallow} from 'enzyme'; import moment from 'moment'; import React from 'react'; import type {ComponentProps} from 'react'; import {fakeDate} from 'tests/helpers/date'; import {LicenseSkus} from 'utils/constants'; import LicenseSettings from './license_settings'; const flushPromises = () => new Promise(setImmediate); describe('components/admin_console/license_settings/LicenseSettings', () => { let resetFakeDate: {(): void}; beforeAll(() => { resetFakeDate = fakeDate(new Date('2021-04-14T12:00:00Z')); }); afterAll(() => { resetFakeDate(); }); const defaultProps: ComponentProps<typeof LicenseSettings> = { isDisabled: false, license: { IsLicensed: 'true', IssuedAt: '1517714643650', StartsAt: '1517714643650', ExpiresAt: '1620335443650', SkuShortName: LicenseSkus.E20, Name: 'LicenseName', Company: 'Mattermost Inc.', Users: '100', }, prevTrialLicense: { IsLicensed: 'false', }, upgradedFromTE: false, enterpriseReady: true, totalUsers: 10, actions: { getLicenseConfig: jest.fn(), uploadLicense: jest.fn(), removeLicense: jest.fn(), upgradeToE0: jest.fn(), ping: jest.fn(), requestTrialLicense: jest.fn(), restartServer: jest.fn(), getPrevTrialLicense: jest.fn(), upgradeToE0Status: jest.fn().mockImplementation(() => Promise.resolve({percentage: 0, error: null})), openModal: jest.fn(), getFilteredUsersStats: jest.fn(), }, }; test('should match snapshot enterprise build with license', () => { const wrapper = shallow<LicenseSettings>(<LicenseSettings {...defaultProps}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot enterprise build with license and isDisabled set to true', () => { const wrapper = shallow<LicenseSettings>( <LicenseSettings {...defaultProps} isDisabled={true} />, ); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot enterprise build with license and upgraded from TE', () => { const props = {...defaultProps, upgradedFromTE: true}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot enterprise build without license', () => { const props = {...defaultProps, license: {IsLicensed: 'false'}}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot enterprise build without license and upgrade from TE', () => { const props = {...defaultProps, license: {IsLicensed: 'false'}, upgradedFromTE: true}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot team edition build without license', () => { const props = {...defaultProps, enterpriseReady: false, license: {IsLicensed: 'false'}}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot team edition build with license', () => { const props = {...defaultProps, enterpriseReady: false}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('upgrade to enterprise click', async () => { const actions = { ...defaultProps.actions, getLicenseConfig: jest.fn(), upgradeToE0: jest.fn(), upgradeToE0Status: jest.fn().mockImplementation(() => Promise.resolve({percentage: 0, error: null})), }; const props = {...defaultProps, enterpriseReady: false, actions}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(actions.getLicenseConfig).toBeCalledTimes(1); expect(actions.upgradeToE0Status).toBeCalledTimes(1); actions.upgradeToE0Status = jest.fn().mockImplementation(() => Promise.resolve({percentage: 1, error: null})); const instance = wrapper.instance(); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore expect(instance.interval).toBe(null); expect(wrapper.state('upgradingPercentage')).toBe(0); await instance.handleUpgrade({preventDefault: jest.fn()} as unknown as React.MouseEvent<HTMLButtonElement>); expect(actions.upgradeToE0).toBeCalledTimes(1); expect(actions.upgradeToE0Status).toBeCalledTimes(1); wrapper.update(); expect(wrapper.update().state('upgradingPercentage')).toBe(1); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore expect(instance.interval).not.toBe(null); }); test('load screen while upgrading', async () => { const actions = { ...defaultProps.actions, upgradeToE0Status: jest.fn().mockImplementation(() => Promise.resolve({percentage: 42, error: null})), }; const props = {...defaultProps, enterpriseReady: false, actions}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); await flushPromises(); expect(wrapper).toMatchSnapshot(); }); test('load screen after upgrading', async () => { const actions = { ...defaultProps.actions, upgradeToE0Status: jest.fn().mockImplementation(() => Promise.resolve({percentage: 100, error: null})), }; const props = {...defaultProps, enterpriseReady: false, actions}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); await flushPromises(); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot enterprise build with trial license', () => { const props = {...defaultProps, license: {IsLicensed: 'true', StartsAt: '1617714643650', IssuedAt: '1617714643650', ExpiresAt: '1620335443650'}}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot team edition with expired trial in the past', () => { const props = {...defaultProps, license: {IsLicensed: 'false'}, prevTrialLicense: {IsLicensed: 'true'}}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot enterprise build with E20 license', () => { const props = {...defaultProps, license: {...defaultProps.license, SkuShortName: LicenseSkus.E20}}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot enterprise build with E10 license', () => { const props = {...defaultProps, license: {...defaultProps.license, SkuShortName: LicenseSkus.E10}}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot enterprise build with Enterprise license', () => { const props = {...defaultProps, license: {...defaultProps.license, SkuShortName: LicenseSkus.Enterprise}}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with expiring license', () => { // Set expiration date to 30 days from today const expiringDate = moment().add(30, 'days').valueOf(); const props = {...defaultProps, license: {...defaultProps.license, ExpiresAt: expiringDate.toString()}}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); test('should match snapshot with cloud expiring license', () => { // Set expiration date to 30 days from today const expiringDate = moment().add(30, 'days').valueOf(); const props = {...defaultProps, license: {...defaultProps.license, ExpiresAt: expiringDate.toString(), Cloud: 'true'}}; const wrapper = shallow<LicenseSettings>(<LicenseSettings {...props}/>); expect(wrapper).toMatchSnapshot(); }); });
1,176
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/license_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/license_settings/__snapshots__/license_settings.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/admin_console/license_settings/LicenseSettings load screen after upgrading 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <RenewLicenseCard isDisabled={false} isLicenseExpired={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } totalUsers={10} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <TeamEdition currentPlan={ <div className="current-plan-legend" > <i className="icon-check-circle" /> Current Plan </div> } openEELicenseModal={[Function]} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(TeamEditionRightPanel) handleRestart={[Function]} handleUpgrade={[Function]} openEEModal={[Function]} restartError={null} restarting={false} setClickNormalUpgradeBtn={[Function]} upgradeError={null} upgradingPercentage={100} /> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings load screen while upgrading 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <RenewLicenseCard isDisabled={false} isLicenseExpired={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } totalUsers={10} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <TeamEdition currentPlan={ <div className="current-plan-legend" > <i className="icon-check-circle" /> Current Plan </div> } openEELicenseModal={[Function]} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(TeamEditionRightPanel) handleRestart={[Function]} handleUpgrade={[Function]} openEEModal={[Function]} restartError={null} restarting={false} setClickNormalUpgradeBtn={[Function]} upgradeError={null} upgradingPercentage={42} /> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot enterprise build with E10 license 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <RenewLicenseCard isDisabled={false} isLicenseExpired={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E10", "StartsAt": "1517714643650", "Users": "100", } } totalUsers={10} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(EnterpriseEditionLeftPanel) fileInputRef={ Object { "current": null, } } handleChange={[Function]} handleRemove={[Function]} isDisabled={false} isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E10", "StartsAt": "1517714643650", "Users": "100", } } openEELicenseModal={[Function]} removing={false} statsActiveUsers={10} upgradedFromTE={false} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(EnterpriseEditionRightPanel) isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E10", "StartsAt": "1517714643650", "Users": "100", } } /> </div> <div className="compare-plans-text" > Curious about upgrading? <ExternalLink href="https://mattermost.com/pl/pricing/" id="privacyLink" location="license_settings" > Compare Plans </ExternalLink> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot enterprise build with E20 license 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <RenewLicenseCard isDisabled={false} isLicenseExpired={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } totalUsers={10} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(EnterpriseEditionLeftPanel) fileInputRef={ Object { "current": null, } } handleChange={[Function]} handleRemove={[Function]} isDisabled={false} isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } openEELicenseModal={[Function]} removing={false} statsActiveUsers={10} upgradedFromTE={false} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(EnterpriseEditionRightPanel) isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } /> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot enterprise build with Enterprise license 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <RenewLicenseCard isDisabled={false} isLicenseExpired={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "enterprise", "StartsAt": "1517714643650", "Users": "100", } } totalUsers={10} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(EnterpriseEditionLeftPanel) fileInputRef={ Object { "current": null, } } handleChange={[Function]} handleRemove={[Function]} isDisabled={false} isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "enterprise", "StartsAt": "1517714643650", "Users": "100", } } openEELicenseModal={[Function]} removing={false} statsActiveUsers={10} upgradedFromTE={false} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(EnterpriseEditionRightPanel) isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "enterprise", "StartsAt": "1517714643650", "Users": "100", } } /> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot enterprise build with license 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <RenewLicenseCard isDisabled={false} isLicenseExpired={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } totalUsers={10} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(EnterpriseEditionLeftPanel) fileInputRef={ Object { "current": null, } } handleChange={[Function]} handleRemove={[Function]} isDisabled={false} isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } openEELicenseModal={[Function]} removing={false} statsActiveUsers={10} upgradedFromTE={false} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(EnterpriseEditionRightPanel) isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } /> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot enterprise build with license and isDisabled set to true 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <RenewLicenseCard isDisabled={true} isLicenseExpired={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } totalUsers={10} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(EnterpriseEditionLeftPanel) fileInputRef={ Object { "current": null, } } handleChange={[Function]} handleRemove={[Function]} isDisabled={true} isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } openEELicenseModal={[Function]} removing={false} statsActiveUsers={10} upgradedFromTE={false} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(EnterpriseEditionRightPanel) isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } /> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot enterprise build with license and upgraded from TE 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <RenewLicenseCard isDisabled={false} isLicenseExpired={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } totalUsers={10} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(EnterpriseEditionLeftPanel) fileInputRef={ Object { "current": null, } } handleChange={[Function]} handleRemove={[Function]} isDisabled={false} isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } openEELicenseModal={[Function]} removing={false} statsActiveUsers={10} upgradedFromTE={true} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(EnterpriseEditionRightPanel) isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } /> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot enterprise build with trial license 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <TrialLicenseCard license={ Object { "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1617714643650", "StartsAt": "1617714643650", } } /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(EnterpriseEditionLeftPanel) fileInputRef={ Object { "current": null, } } handleChange={[Function]} handleRemove={[Function]} isDisabled={false} isTrialLicense={true} license={ Object { "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1617714643650", "StartsAt": "1617714643650", } } openEELicenseModal={[Function]} removing={false} statsActiveUsers={10} upgradedFromTE={false} /> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(EnterpriseEditionRightPanel) isTrialLicense={true} license={ Object { "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1617714643650", "StartsAt": "1617714643650", } } /> </div> <div className="compare-plans-text" > Curious about upgrading? <ExternalLink href="https://mattermost.com/pl/pricing/" id="privacyLink" location="license_settings" > Compare Plans </ExternalLink> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot enterprise build without license 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <Component enterpriseReady={true} gettingTrial={false} gettingTrialError={null} gettingTrialResponseCode={null} handleRestart={[Function]} handleUpgrade={[Function]} isDisabled={false} openEEModal={[Function]} restartError={null} restarting={false} upgradeError={null} upgradingPercentage={0} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(StarterLeftPanel) currentPlan={ <div className="current-plan-legend" > <i className="icon-check-circle" /> Current Plan </div> } fileInputRef={ Object { "current": null, } } handleChange={[Function]} openEELicenseModal={[Function]} upgradedFromTE={false} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(StarterRightPanel) /> </div> <div className="compare-plans-text" > Curious about upgrading? <ExternalLink href="https://mattermost.com/pl/pricing/" id="privacyLink" location="license_settings" > Compare Plans </ExternalLink> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot enterprise build without license and upgrade from TE 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <Component enterpriseReady={true} gettingTrial={false} gettingTrialError={null} gettingTrialResponseCode={null} handleRestart={[Function]} handleUpgrade={[Function]} isDisabled={false} openEEModal={[Function]} restartError={null} restarting={false} upgradeError={null} upgradingPercentage={0} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(StarterLeftPanel) currentPlan={ <div className="current-plan-legend" > <i className="icon-check-circle" /> Current Plan </div> } fileInputRef={ Object { "current": null, } } handleChange={[Function]} openEELicenseModal={[Function]} upgradedFromTE={true} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(StarterRightPanel) /> </div> <div className="compare-plans-text" > Curious about upgrading? <ExternalLink href="https://mattermost.com/pl/pricing/" id="privacyLink" location="license_settings" > Compare Plans </ExternalLink> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot team edition build with license 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <RenewLicenseCard isDisabled={false} isLicenseExpired={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620335443650", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } totalUsers={10} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <TeamEdition currentPlan={ <div className="current-plan-legend" > <i className="icon-check-circle" /> Current Plan </div> } openEELicenseModal={[Function]} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(TeamEditionRightPanel) handleRestart={[Function]} handleUpgrade={[Function]} openEEModal={[Function]} restartError={null} restarting={false} setClickNormalUpgradeBtn={[Function]} upgradeError={null} upgradingPercentage={0} /> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot team edition build without license 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <Component enterpriseReady={false} gettingTrial={false} gettingTrialError={null} gettingTrialResponseCode={null} handleRestart={[Function]} handleUpgrade={[Function]} isDisabled={false} openEEModal={[Function]} restartError={null} restarting={false} upgradeError={null} upgradingPercentage={0} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <TeamEdition currentPlan={ <div className="current-plan-legend" > <i className="icon-check-circle" /> Current Plan </div> } openEELicenseModal={[Function]} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(TeamEditionRightPanel) handleRestart={[Function]} handleUpgrade={[Function]} openEEModal={[Function]} restartError={null} restarting={false} setClickNormalUpgradeBtn={[Function]} upgradeError={null} upgradingPercentage={0} /> </div> <div className="compare-plans-text" > Curious about upgrading? <ExternalLink href="https://mattermost.com/pl/pricing/" id="privacyLink" location="license_settings" > Compare Plans </ExternalLink> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot team edition with expired trial in the past 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" /> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(StarterLeftPanel) currentPlan={ <div className="current-plan-legend" > <i className="icon-check-circle" /> Current Plan </div> } fileInputRef={ Object { "current": null, } } handleChange={[Function]} openEELicenseModal={[Function]} upgradedFromTE={false} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(StarterRightPanel) /> </div> <div className="compare-plans-text" > Curious about upgrading? <ExternalLink href="https://mattermost.com/pl/pricing/" id="privacyLink" location="license_settings" > Compare Plans </ExternalLink> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot with cloud expiring license 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" /> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(EnterpriseEditionLeftPanel) fileInputRef={ Object { "current": null, } } handleChange={[Function]} handleRemove={[Function]} isDisabled={false} isTrialLicense={false} license={ Object { "Cloud": "true", "Company": "Mattermost Inc.", "ExpiresAt": "1620993600000", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } openEELicenseModal={[Function]} removing={false} statsActiveUsers={10} upgradedFromTE={false} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(EnterpriseEditionRightPanel) isTrialLicense={false} license={ Object { "Cloud": "true", "Company": "Mattermost Inc.", "ExpiresAt": "1620993600000", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } /> </div> </div> </div> </div> </div> </div> `; exports[`components/admin_console/license_settings/LicenseSettings should match snapshot with expiring license 1`] = ` <div className="wrapper--fixed" > <AdminHeader> <MemoizedFormattedMessage defaultMessage="Edition and License" id="admin.license.title" /> </AdminHeader> <div className="admin-console__wrapper" > <div className="admin-console__content" > <div className="admin-console__banner_section" > <RenewLicenseCard isDisabled={false} isLicenseExpired={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620993600000", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } totalUsers={10} /> </div> <div className="top-wrapper" > <div className="left-panel" > <div className="panel-card" > <Memo(EnterpriseEditionLeftPanel) fileInputRef={ Object { "current": null, } } handleChange={[Function]} handleRemove={[Function]} isDisabled={false} isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620993600000", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } openEELicenseModal={[Function]} removing={false} statsActiveUsers={10} upgradedFromTE={false} /> </div> <div className="terms-and-policy" > See also <ExternalLink href="https://mattermost.com/pl/terms-of-use/" id="privacyLink" location="license_settings" > Enterprise Edition Terms of Use </ExternalLink> and <ExternalLink href="https://mattermost.com/pl/privacy-policy/" id="privacyLink" location="license_settings" > Privacy Policy </ExternalLink> </div> </div> <div className="right-panel" > <div className="panel-card" > <Memo(EnterpriseEditionRightPanel) isTrialLicense={false} license={ Object { "Company": "Mattermost Inc.", "ExpiresAt": "1620993600000", "IsLicensed": "true", "IssuedAt": "1517714643650", "Name": "LicenseName", "SkuShortName": "E20", "StartsAt": "1517714643650", "Users": "100", } } /> </div> </div> </div> </div> </div> </div> `;
1,178
0
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/license_settings
petrpan-code/mattermost/mattermost/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.test.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import moment from 'moment-timezone'; import React from 'react'; import {Provider} from 'react-redux'; import type {GlobalState} from '@mattermost/types/store'; import type {DeepPartial} from '@mattermost/types/utilities'; import {General} from 'mattermost-redux/constants'; import * as useCanSelfHostedExpand from 'components/common/hooks/useCanSelfHostedExpand'; import mergeObjects from 'packages/mattermost-redux/test/merge_objects'; import {mountWithIntl} from 'tests/helpers/intl-test-helper'; import {renderWithContext, screen} from 'tests/react_testing_utils'; import mockStore from 'tests/test_store'; import {OverActiveUserLimits, SelfHostedProducts} from 'utils/constants'; import {TestHelper} from 'utils/test_helper'; import EnterpriseEditionLeftPanel from './enterprise_edition_left_panel'; import type {EnterpriseEditionProps} from './enterprise_edition_left_panel'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom') as typeof import('react-router-dom'), useLocation: () => { return { pathname: '', }; }, })); describe('components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel', () => { const license = { IsLicensed: 'true', IssuedAt: '1517714643650', StartsAt: '1517714643650', ExpiresAt: '1620335443650', SkuShortName: 'Enterprise', Name: 'LicenseName', Company: 'Mattermost Inc.', Users: '1000', }; const initialState: DeepPartial<GlobalState> = { entities: { users: { currentUserId: 'current_user', profiles: { current_user: { roles: General.SYSTEM_ADMIN_ROLE, id: 'currentUser', }, }, filteredStats: { total_users_count: 0, }, }, general: { license, config: { BuildEnterpriseReady: 'true', }, }, preferences: { myPreferences: {}, }, admin: { config: { ServiceSettings: { SelfHostedPurchase: true, }, }, }, cloud: { subscription: undefined, }, hostedCustomer: { products: { products: { prod_professional: TestHelper.getProductMock({ id: 'prod_professional', name: 'Professional', sku: SelfHostedProducts.PROFESSIONAL, price_per_seat: 7.5, }), }, productsLoaded: true, }, }, }, }; const baseProps: EnterpriseEditionProps = { license, openEELicenseModal: jest.fn(), upgradedFromTE: false, isTrialLicense: false, handleRemove: jest.fn(), isDisabled: false, removing: false, handleChange: jest.fn(), fileInputRef: React.createRef(), statsActiveUsers: 1, }; test('should format the Users field', () => { const store = mockStore(initialState); const wrapper = mountWithIntl( <Provider store={store}> <EnterpriseEditionLeftPanel {...baseProps} /> </Provider>, ); const item = wrapper.find('.item-element').filterWhere((n) => { return n.children().length === 2 && n.childAt(0).type() === 'span' && !n.childAt(0).text().includes('ACTIVE') && n.childAt(0).text().includes('LICENSED SEATS'); }); expect(item.text()).toContain('1,000'); }); test('should not add any class if active users is lower than the minimal', () => { renderWithContext( <EnterpriseEditionLeftPanel {...baseProps} />, initialState, ); expect(screen.getByText(Intl.NumberFormat('en').format(baseProps.statsActiveUsers))).toHaveClass('value'); expect(screen.getByText(Intl.NumberFormat('en').format(baseProps.statsActiveUsers))).not.toHaveClass('value--warning-over-seats-purchased'); expect(screen.getByText(Intl.NumberFormat('en').format(baseProps.statsActiveUsers))).not.toHaveClass('value--over-seats-purchased'); expect(screen.getByText('ACTIVE USERS:')).toHaveClass('legend'); expect(screen.getByText('ACTIVE USERS:')).not.toHaveClass('legend--warning-over-seats-purchased'); expect(screen.getByText('ACTIVE USERS:')).not.toHaveClass('legend--over-seats-purchased'); }); test('should add warning class to active users', () => { const minWarning = Math.ceil(parseInt(license.Users, 10) * OverActiveUserLimits.MIN) + parseInt(license.Users, 10); const props = { ...baseProps, statsActiveUsers: minWarning, }; renderWithContext( <EnterpriseEditionLeftPanel {...props} />, initialState, ); expect(screen.getByText(Intl.NumberFormat('en').format(minWarning))).toHaveClass('value'); expect(screen.getByText(Intl.NumberFormat('en').format(minWarning))).toHaveClass('value--warning-over-seats-purchased'); expect(screen.getByText(Intl.NumberFormat('en').format(minWarning))).not.toHaveClass('value--over-seats-purchased'); expect(screen.getByText('ACTIVE USERS:')).toHaveClass('legend'); expect(screen.getByText('ACTIVE USERS:')).toHaveClass('legend--warning-over-seats-purchased'); expect(screen.getByText('ACTIVE USERS:')).not.toHaveClass('legend--over-seats-purchased'); }); test('should add over-seats-purchased class to active users', () => { const exceedHighLimitExtraUsersError = Math.ceil(parseInt(license.Users, 10) * OverActiveUserLimits.MAX) + parseInt(license.Users, 10); const props = { ...baseProps, statsActiveUsers: exceedHighLimitExtraUsersError, }; renderWithContext( <EnterpriseEditionLeftPanel {...props} />, initialState, ); expect(screen.getByText(Intl.NumberFormat('en').format(exceedHighLimitExtraUsersError))).toHaveClass('value'); expect(screen.getByText(Intl.NumberFormat('en').format(exceedHighLimitExtraUsersError))).toHaveClass('value--over-seats-purchased'); expect(screen.getByText(Intl.NumberFormat('en').format(exceedHighLimitExtraUsersError))).not.toHaveClass('value--warning-over-seats-purchased'); expect(screen.getByText('ACTIVE USERS:')).toHaveClass('legend'); expect(screen.getByText('ACTIVE USERS:')).not.toHaveClass('legend--warning-over-seats-purchased'); expect(screen.getByText('ACTIVE USERS:')).toHaveClass('legend--over-seats-purchased'); }); test('should add warning class to days expired indicator when there are more than 5 days until expiry', () => { const testLicense = { ...license, ExpiresAt: moment().add(6, 'days').valueOf().toString(), }; const testState = mergeObjects(initialState, { entities: { general: { license: testLicense, }, }, }); const props = { ...baseProps, license: testLicense, }; renderWithContext( <EnterpriseEditionLeftPanel {...props} />, testState, ); expect(screen.getByText('Expires in 6 days')).toHaveClass('expiration-days-warning'); }); test('should add danger class to days expired indicator when there are at least 5 days until expiry', () => { const testLicense = { ...license, ExpiresAt: moment().add(5, 'days').valueOf().toString(), }; const testState = mergeObjects(initialState, { entities: { general: { license: testLicense, }, }, }); const props = { ...baseProps, license: testLicense, }; renderWithContext( <EnterpriseEditionLeftPanel {...props} />, testState, ); expect(screen.getByText('Expires in 5 days')).toHaveClass('expiration-days-danger'); }); test('should display add seats button when there are more than 60 days until expiry and self hosted expansion is available', () => { const testLicense = { ...license, ExpiresAt: moment().add(61, 'days').valueOf().toString(), }; const testState = mergeObjects(initialState, { entities: { general: { license: testLicense, }, }, }); const props = { ...baseProps, license: testLicense, }; jest.spyOn(useCanSelfHostedExpand, 'default').mockImplementation(() => true); renderWithContext( <EnterpriseEditionLeftPanel {...props} />, testState, ); expect(screen.getByText('+ Add seats')).toBeVisible(); }); });