diff options
Diffstat (limited to 'spec/frontend/members/components/avatars/group_avatar_spec.js')
-rw-r--r-- | spec/frontend/members/components/avatars/group_avatar_spec.js | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/spec/frontend/members/components/avatars/group_avatar_spec.js b/spec/frontend/members/components/avatars/group_avatar_spec.js index 8e4263f88fe..1463aa5ae59 100644 --- a/spec/frontend/members/components/avatars/group_avatar_spec.js +++ b/spec/frontend/members/components/avatars/group_avatar_spec.js @@ -1,8 +1,9 @@ -import { GlAvatarLink } from '@gitlab/ui'; +import { GlAvatarLabeled, GlAvatarLink } from '@gitlab/ui'; import { getByText as getByTextHelper } from '@testing-library/dom'; import { mount, createWrapper } from '@vue/test-utils'; import GroupAvatar from '~/members/components/avatars/group_avatar.vue'; -import { group as member } from '../../mock_data'; +import PrivateIcon from '~/members/components/icons/private_icon.vue'; +import { group as member, privateGroup as privateMember } from '../../mock_data'; describe('MemberList', () => { let wrapper; @@ -21,11 +22,9 @@ describe('MemberList', () => { const getByText = (text, options) => createWrapper(getByTextHelper(wrapper.element, text, options)); - beforeEach(() => { + it('renders link to group', () => { createComponent(); - }); - it('renders link to group', () => { const link = wrapper.findComponent(GlAvatarLink); expect(link.exists()).toBe(true); @@ -33,10 +32,26 @@ describe('MemberList', () => { }); it("renders group's full name", () => { + createComponent(); + expect(getByText(group.fullName).exists()).toBe(true); }); it("renders group's avatar", () => { + createComponent(); + expect(wrapper.find('img').attributes('src')).toBe(group.avatarUrl); }); + + describe('when group is private', () => { + beforeEach(() => { + createComponent({ member: privateMember }); + }); + + it('renders private avatar with icon', () => { + expect(wrapper.findComponent(GlAvatarLink).exists()).toBe(false); + expect(wrapper.findComponent(GlAvatarLabeled).props('label')).toBe('Private'); + expect(wrapper.findComponent(PrivateIcon).exists()).toBe(true); + }); + }); }); |