diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-24 18:13:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-24 18:13:02 +0000 |
commit | d48b87d4675d6b8b56dd9b40afa9eb2dce32ad3b (patch) | |
tree | 768c3d0900d3ba2910adf6abb24f433b8585be6c /spec/frontend/invite_members | |
parent | fd9a56d56f84b36779fc4db2da37204c22585fe4 (diff) | |
download | gitlab-ce-d48b87d4675d6b8b56dd9b40afa9eb2dce32ad3b.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/invite_members')
-rw-r--r-- | spec/frontend/invite_members/components/invite_members_trigger_spec.js | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/spec/frontend/invite_members/components/invite_members_trigger_spec.js b/spec/frontend/invite_members/components/invite_members_trigger_spec.js index c522abe63c5..e5af38d6ed8 100644 --- a/spec/frontend/invite_members/components/invite_members_trigger_spec.js +++ b/spec/frontend/invite_members/components/invite_members_trigger_spec.js @@ -1,4 +1,4 @@ -import { GlButton, GlLink, GlIcon } from '@gitlab/ui'; +import { GlButton, GlLink, GlIcon, GlDropdownItem } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import InviteMembersTrigger from '~/invite_members/components/invite_members_trigger.vue'; import eventHub from '~/invite_members/event_hub'; @@ -6,7 +6,10 @@ import { TRIGGER_ELEMENT_BUTTON, TRIGGER_ELEMENT_SIDE_NAV, TRIGGER_DEFAULT_QA_SELECTOR, + TRIGGER_ELEMENT_WITH_EMOJI, + TRIGGER_ELEMENT_DROPDOWN_WITH_EMOJI, } from '~/invite_members/constants'; +import { GlEmoji } from '../mock_data/member_modal'; jest.mock('~/experimentation/experiment_tracking'); @@ -20,6 +23,8 @@ const triggerComponent = { button: GlButton, anchor: GlLink, 'side-nav': GlLink, + 'text-emoji': GlLink, + 'dropdown-text-emoji': GlDropdownItem, }; const createComponent = (props = {}) => { @@ -29,6 +34,9 @@ const createComponent = (props = {}) => { ...triggerProps, ...props, }, + stubs: { + GlEmoji, + }, }); }; @@ -43,6 +51,10 @@ const triggerItems = [ triggerElement: TRIGGER_ELEMENT_SIDE_NAV, icon: 'plus', }, + { + triggerElement: TRIGGER_ELEMENT_WITH_EMOJI, + icon: 'shaking_hands', + }, ]; describe.each(triggerItems)('with triggerElement as %s', (triggerItem) => { @@ -119,3 +131,25 @@ describe('side-nav with icon', () => { expect(findIcon().props('name')).toBe('plus'); }); }); + +describe('link with emoji', () => { + it('includes the specified icon with correct size when triggerElement is link', () => { + const findEmoji = () => wrapper.findComponent(GlEmoji); + + createComponent({ triggerElement: TRIGGER_ELEMENT_WITH_EMOJI, icon: 'shaking_hands' }); + + expect(findEmoji().exists()).toBe(true); + expect(findEmoji().attributes('data-name')).toBe('shaking_hands'); + }); +}); + +describe('dropdown item with emoji', () => { + it('includes the specified icon with correct size when triggerElement is link', () => { + const findEmoji = () => wrapper.findComponent(GlEmoji); + + createComponent({ triggerElement: TRIGGER_ELEMENT_DROPDOWN_WITH_EMOJI, icon: 'shaking_hands' }); + + expect(findEmoji().exists()).toBe(true); + expect(findEmoji().attributes('data-name')).toBe('shaking_hands'); + }); +}); |