diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-02 18:10:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-02 18:10:19 +0300 |
commit | cef74ed0434b53fde0d7dcc2507b6f1639a63e7d (patch) | |
tree | 300bc30b6c4272cba3ab65297ede18bfffba2bd2 /spec/frontend/invite_members/components | |
parent | ecdd26856c46b1e9e0c500701b36b6ae338e18a0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/invite_members/components')
-rw-r--r-- | spec/frontend/invite_members/components/invite_modal_base_spec.js | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/frontend/invite_members/components/invite_modal_base_spec.js b/spec/frontend/invite_members/components/invite_modal_base_spec.js index c26d1d921a5..4f4288196ab 100644 --- a/spec/frontend/invite_members/components/invite_modal_base_spec.js +++ b/spec/frontend/invite_members/components/invite_modal_base_spec.js @@ -70,6 +70,7 @@ describe('InviteModalBase', () => { const findDisabledInput = () => wrapper.findByTestId('disabled-input'); const findCancelButton = () => wrapper.findByTestId('invite-modal-cancel'); const findActionButton = () => wrapper.findByTestId('invite-modal-submit'); + const findModal = () => wrapper.findComponent(GlModal); describe('rendering the modal', () => { let trackingSpy; @@ -82,7 +83,7 @@ describe('InviteModalBase', () => { }); it('renders the modal with the correct title', () => { - expect(wrapper.findComponent(GlModal).props('title')).toBe(propsData.modalTitle); + expect(findModal().props('title')).toBe(propsData.modalTitle); }); it('displays the introText', () => { @@ -200,9 +201,7 @@ describe('InviteModalBase', () => { }); trackingSpy = mockTracking(undefined, wrapper.element, jest.spyOn); - const modal = wrapper.findComponent(GlModal); - - modal.vm.$emit('shown'); + findModal().vm.$emit('shown'); expectTracking('render', ON_SHOW_TRACK_LABEL, 'default'); unmockTracking(); @@ -280,4 +279,14 @@ describe('InviteModalBase', () => { state: false, }); }); + + it('emits the shown event when the modal is shown', () => { + createComponent(); + // Verify that the shown event isn't emitted when the component is first created. + expect(wrapper.emitted('shown')).toBeUndefined(); + + findModal().vm.$emit('shown'); + + expect(wrapper.emitted('shown')).toHaveLength(1); + }); }); |