debian-mirror-gitlab/spec/frontend/issue_show/components/pinned_links_spec.js

56 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-03-13 15:44:24 +05:30
import { shallowMount } from '@vue/test-utils';
2019-09-04 21:01:54 +05:30
import { GlLink } from '@gitlab/ui';
import PinnedLinks from '~/issue_show/components/pinned_links.vue';
const plainZoomUrl = 'https://zoom.us/j/123456789';
2020-06-23 00:09:42 +05:30
const plainStatusUrl = 'https://status.com';
2019-09-04 21:01:54 +05:30
describe('PinnedLinks', () => {
let wrapper;
2020-06-23 00:09:42 +05:30
const findLinks = () => wrapper.findAll(GlLink);
2019-09-04 21:01:54 +05:30
const createComponent = props => {
2020-03-13 15:44:24 +05:30
wrapper = shallowMount(PinnedLinks, {
2019-09-04 21:01:54 +05:30
propsData: {
2020-06-23 00:09:42 +05:30
zoomMeetingUrl: '',
publishedIncidentUrl: '',
2019-09-04 21:01:54 +05:30
...props,
},
});
};
it('displays Zoom link', () => {
createComponent({
2019-09-30 21:07:59 +05:30
zoomMeetingUrl: `<a href="${plainZoomUrl}">Zoom</a>`,
2019-09-04 21:01:54 +05:30
});
2020-06-23 00:09:42 +05:30
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');
2019-09-04 21:01:54 +05:30
});
2019-09-30 21:07:59 +05:30
it('does not render if there are no links', () => {
2019-09-04 21:01:54 +05:30
createComponent({
2020-06-23 00:09:42 +05:30
zoomMeetingUrl: '',
publishedIncidentUrl: '',
2019-09-04 21:01:54 +05:30
});
expect(wrapper.find(GlLink).exists()).toBe(false);
});
});