mattermost-mobile/test/app/actions/options_modal.js
enahum bfd70f742c Modal with options (#179)
* modal options and channel long press

* PureComponent optimization (#183)

* Bug fix when leaving the current channel

* Rebased with new navigation

* Add disabled drawer to unit test

* re-organize modal up in the stack and controlled by redux

* renaming modalOptions to optionsModal
2017-01-30 08:41:14 -05:00

30 lines
1,012 B
JavaScript

// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import assert from 'assert';
import * as Actions from 'app/actions/views/options_modal';
import configureStore from 'app/store';
describe('Actions.Views.OptionsModal', () => {
let store;
beforeEach(() => {
store = configureStore();
});
it('openModal', async () => {
await Actions.openModal('title', [1, 2, 3])(store.dispatch, store.getState);
const {optionsModal} = store.getState().views;
assert.equal('title', optionsModal.title);
assert.deepEqual([1, 2, 3], optionsModal.options);
assert.ok(optionsModal.visible);
});
it('closeModal', async () => {
await Actions.closeModal()(store.dispatch, store.getState);
const {optionsModal} = store.getState().views;
assert.equal('', optionsModal.title);
assert.deepEqual([], optionsModal.options);
assert.ifError(optionsModal.visible);
});
});