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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-04 06:08:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-04 06:08:22 +0300
commit583bde3f83951fa4c294804edc2e9c57fb293733 (patch)
tree83900919e93ea9c1dab7571c9d4e02e73d8b8fb5 /spec/frontend/groups
parentdc965b8cc88f8dadf879c0d80214864c699ebf1f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/groups')
-rw-r--r--spec/frontend/groups/components/invite_members_banner_spec.js76
1 files changed, 76 insertions, 0 deletions
diff --git a/spec/frontend/groups/components/invite_members_banner_spec.js b/spec/frontend/groups/components/invite_members_banner_spec.js
new file mode 100644
index 00000000000..f86091d427c
--- /dev/null
+++ b/spec/frontend/groups/components/invite_members_banner_spec.js
@@ -0,0 +1,76 @@
+import { shallowMount } from '@vue/test-utils';
+import { GlBanner } from '@gitlab/ui';
+import InviteMembersBanner from '~/groups/components/invite_members_banner.vue';
+
+const expectedTitle = 'Collaborate with your team';
+const expectedBody =
+ "We noticed that you haven't invited anyone to this group. Invite your colleagues so you can discuss issues, collaborate on merge requests, and share your knowledge";
+const expectedSvgPath = '/illustrations/background';
+const expectedInviteMembersPath = 'groups/members';
+const expectedButtonText = 'Invite your colleagues';
+
+const createComponent = (stubs = {}) => {
+ return shallowMount(InviteMembersBanner, {
+ provide: {
+ svgPath: expectedSvgPath,
+ inviteMembersPath: expectedInviteMembersPath,
+ },
+ stubs,
+ });
+};
+
+describe('InviteMembersBanner', () => {
+ let wrapper;
+
+ afterEach(() => {
+ wrapper.destroy();
+ wrapper = null;
+ });
+
+ describe('rendering', () => {
+ const findBanner = () => {
+ return wrapper.find(GlBanner);
+ };
+
+ beforeEach(() => {
+ wrapper = createComponent();
+ });
+
+ it('uses the svgPath for the banner svgpath', () => {
+ expect(findBanner().attributes('svgpath')).toBe(expectedSvgPath);
+ });
+
+ it('uses the title from options for title', () => {
+ expect(findBanner().attributes('title')).toBe(expectedTitle);
+ });
+
+ it('includes the body text from options', () => {
+ expect(findBanner().html()).toContain(expectedBody);
+ });
+
+ it('uses the button_text text from options for buttontext', () => {
+ expect(findBanner().attributes('buttontext')).toBe(expectedButtonText);
+ });
+
+ it('uses the href from inviteMembersPath for buttonlink', () => {
+ expect(findBanner().attributes('buttonlink')).toBe(expectedInviteMembersPath);
+ });
+ });
+
+ describe('dismissing', () => {
+ const findButton = () => {
+ return wrapper.find('button');
+ };
+ const stubs = {
+ GlBanner,
+ };
+
+ it('sets visible to false', () => {
+ wrapper = createComponent(stubs);
+
+ findButton().trigger('click');
+
+ expect(wrapper.vm.visible).toBe(false);
+ });
+ });
+});