diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-08 15:13:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-08 15:13:55 +0300 |
commit | 571b02efc9442e73538c3438eb593a83d7807779 (patch) | |
tree | 96c4ecbdaa066fac502111a3192cc396d6f4a79a /spec/frontend/vue_merge_request_widget | |
parent | efe3186770a4218333e1a720f1e4d3794892673e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_merge_request_widget')
-rw-r--r-- | spec/frontend/vue_merge_request_widget/components/states/merge_failed_pipeline_confirmation_dialog_spec.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/frontend/vue_merge_request_widget/components/states/merge_failed_pipeline_confirmation_dialog_spec.js b/spec/frontend/vue_merge_request_widget/components/states/merge_failed_pipeline_confirmation_dialog_spec.js index 7d471b91c37..d321ff6e668 100644 --- a/spec/frontend/vue_merge_request_widget/components/states/merge_failed_pipeline_confirmation_dialog_spec.js +++ b/spec/frontend/vue_merge_request_widget/components/states/merge_failed_pipeline_confirmation_dialog_spec.js @@ -3,6 +3,8 @@ import MergeFailedPipelineConfirmationDialog from '~/vue_merge_request_widget/co import { trimText } from 'helpers/text_helper'; describe('MergeFailedPipelineConfirmationDialog', () => { + const mockModalHide = jest.fn(); + let wrapper; const GlModal = { @@ -13,7 +15,7 @@ describe('MergeFailedPipelineConfirmationDialog', () => { </div> `, methods: { - hide: jest.fn(), + hide: mockModalHide, }, }; @@ -37,6 +39,10 @@ describe('MergeFailedPipelineConfirmationDialog', () => { createComponent(); }); + afterEach(() => { + mockModalHide.mockReset(); + }); + it('should render informational text explaining why merging immediately can be dangerous', () => { expect(trimText(wrapper.text())).toContain( 'The latest pipeline for this merge request did not succeed. The latest changes are unverified. Are you sure you want to attempt to merge?', @@ -50,12 +56,10 @@ describe('MergeFailedPipelineConfirmationDialog', () => { }); it('when the cancel button is clicked should emit cancel and call hide', () => { - jest.spyOn(findModal().vm, 'hide'); - findCancelBtn().vm.$emit('click'); expect(wrapper.emitted('cancel')).toHaveLength(1); - expect(findModal().vm.hide).toHaveBeenCalled(); + expect(mockModalHide).toHaveBeenCalled(); }); it('should emit cancel when the hide event is emitted', () => { |