2019-01-02 13:34:19 -05:00
|
|
|
import mutations from '~/vuex_shared/modules/modal/mutations';
|
|
|
|
import * as types from '~/vuex_shared/modules/modal/mutation_types';
|
|
|
|
|
|
|
|
describe('Vuex ModalModule mutations', () => {
|
2019-04-08 14:17:53 -04:00
|
|
|
describe(`${types.SHOW}`, () => {
|
2019-01-02 13:34:19 -05:00
|
|
|
it('sets isVisible to true', () => {
|
|
|
|
const state = {
|
|
|
|
isVisible: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
mutations[types.SHOW](state);
|
|
|
|
|
|
|
|
expect(state).toEqual({
|
|
|
|
isVisible: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-04-08 14:17:53 -04:00
|
|
|
describe(`${types.HIDE}`, () => {
|
2019-01-02 13:34:19 -05:00
|
|
|
it('sets isVisible to false', () => {
|
|
|
|
const state = {
|
|
|
|
isVisible: true,
|
|
|
|
};
|
|
|
|
|
|
|
|
mutations[types.HIDE](state);
|
|
|
|
|
|
|
|
expect(state).toEqual({
|
|
|
|
isVisible: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-04-08 14:17:53 -04:00
|
|
|
describe(`${types.OPEN}`, () => {
|
2019-01-02 13:34:19 -05:00
|
|
|
it('sets data and sets isVisible to true', () => {
|
|
|
|
const data = { id: 7 };
|
|
|
|
const state = {
|
|
|
|
isVisible: false,
|
|
|
|
data: null,
|
|
|
|
};
|
|
|
|
|
|
|
|
mutations[types.OPEN](state, data);
|
|
|
|
|
|
|
|
expect(state).toEqual({
|
|
|
|
isVisible: true,
|
|
|
|
data,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|