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

44 lines
951 B
JavaScript
Raw Normal View History

2020-03-09 13:42:32 +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';
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-03-09 13:42:32 +05:30
wrapper = shallowMount(PinnedLinks, {
2019-09-04 21:01:54 +05:30
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);
});
});