[MM-22300] Use dismissModal to close ChannelInfo screen (#3890)

* Use dismissModal to close ChannelInfo screen

* Missing semicolon
This commit is contained in:
Miguel Alatzar 2020-02-05 17:18:59 -07:00 committed by GitHub
parent 11e09399f7
commit 2464780eca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View file

@ -18,7 +18,7 @@ import {preventDoubleTap} from 'app/utils/tap';
import {alertErrorWithFallback} from 'app/utils/general';
import {changeOpacity, makeStyleSheetFromTheme, setNavigatorStyles} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import {dismissModal, goToScreen, popTopScreen, showModalOverCurrentContext} from 'app/actions/navigation';
import {dismissModal, goToScreen, showModalOverCurrentContext} from 'app/actions/navigation';
import pinIcon from 'assets/images/channel_info/pin.png';
@ -127,7 +127,7 @@ export default class ChannelInfo extends PureComponent {
actions.setChannelDisplayName('');
}
popTopScreen();
dismissModal();
};
goToChannelAddMembers = preventDoubleTap(() => {

View file

@ -6,6 +6,8 @@ import {shallow} from 'enzyme';
import Preferences from 'mattermost-redux/constants/preferences';
import {General} from 'mattermost-redux/constants';
import * as NavigationActions from 'app/actions/navigation';
import ChannelInfo from './channel_info';
// ChannelInfoRow expects to receive the pinIcon as a number
@ -149,4 +151,19 @@ describe('channel_info', () => {
const render = instance.renderConvertToPrivateRow();
expect(render).toBeFalsy();
});
test('should dismiss modal on close', () => {
const dismissModal = jest.spyOn(NavigationActions, 'dismissModal');
const wrapper = shallow(
<ChannelInfo
{...baseProps}
/>,
{context: {intl: intlMock}},
);
const instance = wrapper.instance();
expect(dismissModal).not.toHaveBeenCalled();
instance.close();
expect(dismissModal).toHaveBeenCalled();
});
});