2020-01-08 07:07:59 -05:00
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2019-06-11 00:15:08 -04:00
|
|
|
import { GlLink } from '@gitlab/ui';
|
|
|
|
import PinnedLinks from '~/issue_show/components/pinned_links.vue';
|
|
|
|
|
|
|
|
const plainZoomUrl = 'https://zoom.us/j/123456789';
|
|
|
|
|
|
|
|
describe('PinnedLinks', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
const link = {
|
|
|
|
get text() {
|
|
|
|
return wrapper.find(GlLink).text();
|
|
|
|
},
|
|
|
|
get href() {
|
|
|
|
return wrapper.find(GlLink).attributes('href');
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const createComponent = props => {
|
2020-01-08 07:07:59 -05:00
|
|
|
wrapper = shallowMount(PinnedLinks, {
|
2019-06-11 00:15:08 -04:00
|
|
|
propsData: {
|
2019-07-17 02:41:26 -04:00
|
|
|
zoomMeetingUrl: null,
|
2019-06-11 00:15:08 -04:00
|
|
|
...props,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
it('displays Zoom link', () => {
|
|
|
|
createComponent({
|
2019-07-17 02:41:26 -04:00
|
|
|
zoomMeetingUrl: `<a href="${plainZoomUrl}">Zoom</a>`,
|
2019-06-11 00:15:08 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
expect(link.text).toBe('Join Zoom meeting');
|
|
|
|
});
|
|
|
|
|
2019-07-17 02:41:26 -04:00
|
|
|
it('does not render if there are no links', () => {
|
2019-06-11 00:15:08 -04:00
|
|
|
createComponent({
|
2019-07-17 02:41:26 -04:00
|
|
|
zoomMeetingUrl: null,
|
2019-06-11 00:15:08 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper.find(GlLink).exists()).toBe(false);
|
|
|
|
});
|
|
|
|
});
|