Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
MM-13265: Creating new set of widgets to build dropdown menus (#2201)
Browse files Browse the repository at this point in the history
* MM-13265: Creating new set of widgets to build dropdown menus

* Improving unit tests

* Adding tests for the main menu component

* Adding ids for e2e testing

* fixed popmotion version

* Fixing some cypress tests

* Fixed proberly the cypress tests

* Using correct types for menu items texts and dialogTypes

* Using menu wrapper on ldap groups new interface

* Removing unneded component BootstrapSpan

* Fixing unit tests

* Fixed a small styling problem

* More small fixes

* Fixing some e2e tests

* Adding aria-label to all menus

* Fixing rebase conflicts

* Fixed small bug

* Fix comments

* Fix emoji picker on the RHS

* Fixed system users dropdown menu

* Fixing Manage Teams modal styling

* Fixed some styles for mobile

* Fixed some bugs found in the review

* Fixed another small bug

* fixing check-style

* Fixed manage members menu

* Fixing dots menu styling on dark theme

* Fixed mentions icon style in mobile menu

* More small fixes

* Fixed bug in Manage teams modal

* Fix emoji picker on the center panel

* Fixed tests

* Fixing a small bug

* Fixing tests
  • Loading branch information
jespino committed Feb 27, 2019
1 parent 1a30ce9 commit 6a29953
Show file tree
Hide file tree
Showing 159 changed files with 5,775 additions and 6,538 deletions.
61 changes: 61 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2358,3 +2358,64 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---

## popmotion

The MIT License (MIT)

Copyright (c) 2018 Inventing With Monster Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

---

## react-transition-group

BSD 3-Clause License

Copyright (c) 2018, React Community
Forked from React (https://github.com/facebook/react) Copyright 2013-present, Facebook, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 2 additions & 2 deletions components/about_build_modal/about_build_modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class AboutBuildModal extends React.PureComponent {
/**
* Function that is called when the modal is dismissed
*/
onModalDismissed: PropTypes.func.isRequired,
onHide: PropTypes.func.isRequired,

/**
* Global config object
Expand All @@ -48,7 +48,7 @@ export default class AboutBuildModal extends React.PureComponent {
}

doHide() {
this.props.onModalDismissed();
this.props.onHide();
}

render() {
Expand Down
8 changes: 4 additions & 4 deletions components/about_build_modal/about_build_modal.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('components/AboutBuildModal', () => {
expect(wrapper.find('#buildnumberString').text()).toBe('\u00a0123');
});

test('should call onModalDismissed callback when the modal is hidden', (done) => {
test('should call onHide callback when the modal is hidden', (done) => {
function onHide() {
done();
}
Expand All @@ -111,20 +111,20 @@ describe('components/AboutBuildModal', () => {
license={license}
webappBuildHash='0a1b2c3d4f'
show={true}
onModalDismissed={onHide}
onHide={onHide}
/>
);

wrapper.find(Modal).first().props().onHide();
});

function shallowAboutBuildModal(props = {}) {
const onModalDismissed = jest.fn();
const onHide = jest.fn();
const show = true;

const allProps = {
show,
onModalDismissed,
onHide,
webappBuildHash: '0a1b2c3d4f',
...props,
};
Expand Down
5 changes: 5 additions & 0 deletions components/about_build_modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
import {connect} from 'react-redux';
import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general';

import {ModalIdentifiers} from 'utils/constants';
import {isModalOpen} from 'selectors/views/modals';

import AboutBuildModal from './about_build_modal.jsx';

function mapStateToProps(state) {
const modalId = ModalIdentifiers.ABOUT;
return {
config: getConfig(state),
license: getLicense(state),
show: isModalOpen(state, modalId),
};
}

Expand Down
6 changes: 3 additions & 3 deletions components/add_users_to_team/add_users_to_team.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class AddUsersToTeam extends React.Component {
currentTeamId: PropTypes.string.isRequired,
searchTerm: PropTypes.string.isRequired,
users: PropTypes.array.isRequired,
onModalDismissed: PropTypes.func,
onHide: PropTypes.func,
actions: PropTypes.shape({
getProfilesNotInTeam: PropTypes.func.isRequired,
setModalSearchTerm: PropTypes.func.isRequired,
Expand Down Expand Up @@ -83,8 +83,8 @@ export default class AddUsersToTeam extends React.Component {
}

handleExit = () => {
if (this.props.onModalDismissed) {
this.props.onModalDismissed();
if (this.props.onHide) {
this.props.onHide();
}
}

Expand Down
10 changes: 5 additions & 5 deletions components/add_users_to_team/add_users_to_team.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('components/AddUsersToTeam', () => {
currentTeamName: 'display_name',
searchTerm: '',
users: [{id: 'someid', username: 'somename', email: 'someemail'}],
onModalDismissed: jest.fn(),
onHide: jest.fn(),
actions: baseActions,
};

Expand All @@ -47,15 +47,15 @@ describe('components/AddUsersToTeam', () => {
expect(wrapper.state('show')).toEqual(false);
});

test('should have called onModalDismissed when handleExit is called', () => {
const onModalDismissed = jest.fn();
const props = {...baseProps, onModalDismissed};
test('should have called onHide when handleExit is called', () => {
const onHide = jest.fn();
const props = {...baseProps, onHide};
const wrapper = shallow(
<AddUsersToTeam {...props}/>
);

wrapper.instance().handleExit();
expect(onModalDismissed).toHaveBeenCalledTimes(1);
expect(onHide).toHaveBeenCalledTimes(1);
});

test('should match state when handleResponse is called', () => {
Expand Down
5 changes: 5 additions & 0 deletions components/add_users_to_team/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import {loadStatusesForProfilesList} from 'actions/status_actions.jsx';
import {addUsersToTeam} from 'actions/team_actions.jsx';
import {setModalSearchTerm} from 'actions/views/search';

import {ModalIdentifiers} from 'utils/constants';
import {isModalOpen} from 'selectors/views/modals';

import AddUsersToTeam from './add_users_to_team.jsx';

function mapStateToProps(state) {
Expand All @@ -24,12 +27,14 @@ function mapStateToProps(state) {
}

const team = getCurrentTeam(state) || {};
const modalId = ModalIdentifiers.ADD_USER_TO_TEAM;

return {
currentTeamName: team.display_name,
currentTeamId: team.id,
searchTerm,
users,
show: isModalOpen(state, modalId),
};
}

Expand Down
2 changes: 2 additions & 0 deletions components/admin_console/admin_console.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import MessageExportSettings from 'components/admin_console/message_export_setti
import PasswordSettings from 'components/admin_console/password_settings.jsx';
import GroupDetails from 'components/admin_console/group_settings/group_details';
import CustomTermsOfServiceSettings from 'components/admin_console/custom_terms_of_service_settings';
import ModalController from 'components/modal_controller';

import SchemaAdminSettings from 'components/admin_console/schema_admin_settings';
import PushSettings from 'components/admin_console/push_settings.jsx';
Expand Down Expand Up @@ -638,6 +639,7 @@ export default class AdminConsole extends React.Component {
</Switch>
</div>
{discardChangesModal}
<ModalController/>
</div>
);
}
Expand Down
Loading

0 comments on commit 6a29953

Please sign in to comment.