diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
commit | 5afcbe03ead9ada87621888a31a62652b10a7e4f (patch) | |
tree | 9918b67a0d0f0bafa6542e839a8be37adf73102d /spec/frontend/vue_shared/issuable/list/components/issuable_item_spec.js | |
parent | c97c0201564848c1f53226fe19d71fdcc472f7d0 (diff) |
Add latest changes from gitlab-org/gitlab@16-4-stable-eev16.4.0-rc42
Diffstat (limited to 'spec/frontend/vue_shared/issuable/list/components/issuable_item_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/issuable/list/components/issuable_item_spec.js | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/spec/frontend/vue_shared/issuable/list/components/issuable_item_spec.js b/spec/frontend/vue_shared/issuable/list/components/issuable_item_spec.js index 77333a878d1..9f7254ba0e6 100644 --- a/spec/frontend/vue_shared/issuable/list/components/issuable_item_spec.js +++ b/spec/frontend/vue_shared/issuable/list/components/issuable_item_spec.js @@ -1,5 +1,6 @@ import { GlLink, GlLabel, GlIcon, GlFormCheckbox, GlSprintf } from '@gitlab/ui'; import { nextTick } from 'vue'; +import { escape } from 'lodash'; import { useFakeDate } from 'helpers/fake_date'; import { shallowMountExtended as shallowMount } from 'helpers/vue_test_utils_helper'; import IssuableItem from '~/vue_shared/issuable/list/components/issuable_item.vue'; @@ -63,6 +64,14 @@ describe('IssuableItem', () => { }); }); + describe('externalAuthor', () => { + it('returns `externalAuthor` reference', () => { + wrapper = createComponent(); + + expect(wrapper.vm.externalAuthor).toEqual(mockIssuable.externalAuthor); + }); + }); + describe('authorId', () => { it.each` authorId | returnValue @@ -279,10 +288,23 @@ describe('IssuableItem', () => { expect(titleEl.exists()).toBe(true); expect(titleEl.findComponent(GlLink).attributes('href')).toBe(expectedHref); expect(titleEl.findComponent(GlLink).attributes('target')).toBe(expectedTarget); - expect(titleEl.findComponent(GlLink).text()).toBe(mockIssuable.title); + expect(titleEl.findComponent(GlLink).html()).toContain(mockIssuable.titleHtml); }, ); + it('renders issuable title with escaped markup when issue tracker is external', () => { + const mockTitle = '<script>foobar</script>'; + wrapper = createComponent({ + issuable: { + ...mockIssuable, + title: mockTitle, + externalTracker: 'jira', + }, + }); + + expect(wrapper.findByTestId('issuable-title').html()).toContain(escape(mockTitle)); + }); + it('renders checkbox when `showCheckbox` prop is true', async () => { wrapper = createComponent({ showCheckbox: true, @@ -437,6 +459,15 @@ describe('IssuableItem', () => { expect(authorEl.text()).toBe(mockAuthor.name); }); + it('renders issuable external author info via author slot', () => { + wrapper = createComponent({ + issuableSymbol: '#', + issuable: { ...mockIssuable, externalAuthor: 'client@example.com' }, + }); + + expect(wrapper.findByTestId('external-author').text()).toBe('client@example.com via'); + }); + it('renders timeframe via slot', () => { wrapper = createComponent({ issuableSymbol: '#', |