diff options
Diffstat (limited to 'spec/frontend/pages/projects/learn_gitlab/components')
-rw-r--r-- | spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_spec.js.snap | 7 | ||||
-rw-r--r-- | spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_spec.js | 33 |
2 files changed, 39 insertions, 1 deletions
diff --git a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_spec.js.snap b/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_spec.js.snap index 3aa0e99a858..3e371a8765f 100644 --- a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_spec.js.snap +++ b/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_spec.js.snap @@ -135,6 +135,7 @@ exports[`Learn GitLab renders correctly 1`] = ` <a class="gl-link" data-track-action="click_link" + data-track-experiment="change_continuous_onboarding_link_urls" data-track-label="Set up CI/CD" data-track-property="Growth::Conversion::Experiment::LearnGitLab" href="http://example.com/" @@ -156,6 +157,7 @@ exports[`Learn GitLab renders correctly 1`] = ` <a class="gl-link" data-track-action="click_link" + data-track-experiment="change_continuous_onboarding_link_urls" data-track-label="Start a free Ultimate trial" data-track-property="Growth::Conversion::Experiment::LearnGitLab" href="http://example.com/" @@ -177,6 +179,7 @@ exports[`Learn GitLab renders correctly 1`] = ` <a class="gl-link" data-track-action="click_link" + data-track-experiment="change_continuous_onboarding_link_urls" data-track-label="Add code owners" data-track-property="Growth::Conversion::Experiment::LearnGitLab" href="http://example.com/" @@ -205,6 +208,7 @@ exports[`Learn GitLab renders correctly 1`] = ` <a class="gl-link" data-track-action="click_link" + data-track-experiment="change_continuous_onboarding_link_urls" data-track-label="Add merge request approval" data-track-property="Growth::Conversion::Experiment::LearnGitLab" href="http://example.com/" @@ -269,6 +273,7 @@ exports[`Learn GitLab renders correctly 1`] = ` <a class="gl-link" data-track-action="click_link" + data-track-experiment="change_continuous_onboarding_link_urls" data-track-label="Create an issue" data-track-property="Growth::Conversion::Experiment::LearnGitLab" href="http://example.com/" @@ -290,6 +295,7 @@ exports[`Learn GitLab renders correctly 1`] = ` <a class="gl-link" data-track-action="click_link" + data-track-experiment="change_continuous_onboarding_link_urls" data-track-label="Submit a merge request" data-track-property="Growth::Conversion::Experiment::LearnGitLab" href="http://example.com/" @@ -347,6 +353,7 @@ exports[`Learn GitLab renders correctly 1`] = ` <a class="gl-link" data-track-action="click_link" + data-track-experiment="change_continuous_onboarding_link_urls" data-track-label="Run a Security scan using CI/CD" data-track-property="Growth::Conversion::Experiment::LearnGitLab" href="http://example.com/" diff --git a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_spec.js b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_spec.js index f8099d7e95a..7e97a539a99 100644 --- a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_spec.js +++ b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_spec.js @@ -1,13 +1,17 @@ import { GlProgressBar } from '@gitlab/ui'; import { mount } from '@vue/test-utils'; import LearnGitlab from '~/pages/projects/learn_gitlab/components/learn_gitlab.vue'; +import eventHub from '~/invite_members/event_hub'; import { testActions, testSections } from './mock_data'; describe('Learn GitLab', () => { let wrapper; + let inviteMembersOpen = false; const createWrapper = () => { - wrapper = mount(LearnGitlab, { propsData: { actions: testActions, sections: testSections } }); + wrapper = mount(LearnGitlab, { + propsData: { actions: testActions, sections: testSections, inviteMembersOpen }, + }); }; beforeEach(() => { @@ -17,6 +21,7 @@ describe('Learn GitLab', () => { afterEach(() => { wrapper.destroy(); wrapper = null; + inviteMembersOpen = false; }); it('renders correctly', () => { @@ -35,4 +40,30 @@ describe('Learn GitLab', () => { expect(progressBar.attributes('value')).toBe('2'); expect(progressBar.attributes('max')).toBe('9'); }); + + describe('Invite Members Modal', () => { + let spy; + + beforeEach(() => { + spy = jest.spyOn(eventHub, '$emit'); + }); + + it('emits openModal', () => { + inviteMembersOpen = true; + + createWrapper(); + + expect(spy).toHaveBeenCalledWith('openModal', { + mode: 'celebrate', + inviteeType: 'members', + source: 'learn-gitlab', + }); + }); + + it('does not emit openModal', () => { + createWrapper(); + + expect(spy).not.toHaveBeenCalled(); + }); + }); }); |