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

48 lines
1 KiB
JavaScript
Raw Normal View History

2019-09-04 21:01:54 +05:30
import { shallowMount, createLocalVue } from '@vue/test-utils';
import { GlLink } from '@gitlab/ui';
import PinnedLinks from '~/issue_show/components/pinned_links.vue';
const localVue = createLocalVue();
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 => {
wrapper = shallowMount(localVue.extend(PinnedLinks), {
localVue,
sync: false,
propsData: {
2019-09-30 21:07:59 +05:30
zoomMeetingUrl: null,
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
});
expect(link.text).toBe('Join Zoom meeting');
});
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({
2019-09-30 21:07:59 +05:30
zoomMeetingUrl: null,
2019-09-04 21:01:54 +05:30
});
expect(wrapper.find(GlLink).exists()).toBe(false);
});
});