Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/vue_shared/components/gl_modal_vuex_spec.js')
-rw-r--r--spec/frontend/vue_shared/components/gl_modal_vuex_spec.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/gl_modal_vuex_spec.js b/spec/frontend/vue_shared/components/gl_modal_vuex_spec.js
index 8437e68d73c..93f4db5df18 100644
--- a/spec/frontend/vue_shared/components/gl_modal_vuex_spec.js
+++ b/spec/frontend/vue_shared/components/gl_modal_vuex_spec.js
@@ -38,6 +38,9 @@ describe('GlModalVuex', () => {
localVue,
store,
propsData,
+ stubs: {
+ GlModal,
+ },
});
};
@@ -148,4 +151,29 @@ describe('GlModalVuex', () => {
.then(done)
.catch(done.fail);
});
+
+ it.each(['ok', 'cancel'])(
+ 'passes an "%s" handler to the "modal-footer" slot scope',
+ handlerName => {
+ state.isVisible = true;
+
+ const modalFooterSlotContent = jest.fn();
+
+ factory({
+ scopedSlots: {
+ 'modal-footer': modalFooterSlotContent,
+ },
+ });
+
+ const handler = modalFooterSlotContent.mock.calls[0][0][handlerName];
+
+ expect(wrapper.emitted(handlerName)).toBeFalsy();
+ expect(actions.hide).not.toHaveBeenCalled();
+
+ handler();
+
+ expect(actions.hide).toHaveBeenCalledTimes(1);
+ expect(wrapper.emitted(handlerName)).toBeTruthy();
+ },
+ );
});