diff options
Diffstat (limited to 'spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js index 1d2a9c34599..14e0c8a2278 100644 --- a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js @@ -197,4 +197,26 @@ describe('LabelsSelect Mutations', () => { }); }); }); + + describe(`${types.UPDATE_LABELS_SET_STATE}`, () => { + it('updates labels `set` state to match selected labels', () => { + const state = { + labels: [ + { id: 1, title: 'scoped::test', set: false }, + { id: 2, set: true, title: 'scoped::one', touched: true }, + { id: 3, title: '' }, + { id: 4, title: '' }, + ], + selectedLabels: [{ id: 1 }, { id: 3 }], + }; + mutations[types.UPDATE_LABELS_SET_STATE](state); + + expect(state.labels).toEqual([ + { id: 1, title: 'scoped::test', set: true }, + { id: 2, set: false, title: 'scoped::one', touched: true }, + { id: 3, title: '', set: true }, + { id: 4, title: '', set: false }, + ]); + }); + }); }); |