diff options
Diffstat (limited to 'spec/frontend/issue_show/components/pinned_links_spec.js')
-rw-r--r-- | spec/frontend/issue_show/components/pinned_links_spec.js | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/spec/frontend/issue_show/components/pinned_links_spec.js b/spec/frontend/issue_show/components/pinned_links_spec.js index 59c919c85d5..007ad4c9a1b 100644 --- a/spec/frontend/issue_show/components/pinned_links_spec.js +++ b/spec/frontend/issue_show/components/pinned_links_spec.js @@ -3,23 +3,18 @@ import { GlLink } from '@gitlab/ui'; import PinnedLinks from '~/issue_show/components/pinned_links.vue'; const plainZoomUrl = 'https://zoom.us/j/123456789'; +const plainStatusUrl = 'https://status.com'; describe('PinnedLinks', () => { let wrapper; - const link = { - get text() { - return wrapper.find(GlLink).text(); - }, - get href() { - return wrapper.find(GlLink).attributes('href'); - }, - }; + const findLinks = () => wrapper.findAll(GlLink); const createComponent = props => { wrapper = shallowMount(PinnedLinks, { propsData: { - zoomMeetingUrl: null, + zoomMeetingUrl: '', + publishedIncidentUrl: '', ...props, }, }); @@ -30,12 +25,29 @@ describe('PinnedLinks', () => { zoomMeetingUrl: `<a href="${plainZoomUrl}">Zoom</a>`, }); - expect(link.text).toBe('Join Zoom meeting'); + expect( + findLinks() + .at(0) + .text(), + ).toBe('Join Zoom meeting'); + }); + + it('displays Status link', () => { + createComponent({ + publishedIncidentUrl: `<a href="${plainStatusUrl}">Status</a>`, + }); + + expect( + findLinks() + .at(0) + .text(), + ).toBe('Published on status page'); }); it('does not render if there are no links', () => { createComponent({ - zoomMeetingUrl: null, + zoomMeetingUrl: '', + publishedIncidentUrl: '', }); expect(wrapper.find(GlLink).exists()).toBe(false); |