debian-mirror-gitlab/spec/frontend/issues/show/components/pinned_links_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-07-28 23:09:34 +05:30
import { GlButton } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import { shallowMount } from '@vue/test-utils';
2022-01-26 12:08:38 +05:30
import PinnedLinks from '~/issues/show/components/pinned_links.vue';
import { STATUS_PAGE_PUBLISHED, JOIN_ZOOM_MEETING } from '~/issues/show/constants';
2019-09-04 21:01:54 +05:30
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;
2022-10-11 01:57:18 +05:30
const findButtons = () => wrapper.findAllComponents(GlButton);
2019-09-04 21:01:54 +05:30
2021-03-08 18:12:59 +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
});
2021-03-08 18:12:59 +05:30
expect(findButtons().at(0).text()).toBe(JOIN_ZOOM_MEETING);
2020-06-23 00:09:42 +05:30
});
it('displays Status link', () => {
createComponent({
publishedIncidentUrl: `<a href="${plainStatusUrl}">Status</a>`,
});
2021-03-08 18:12:59 +05:30
expect(findButtons().at(0).text()).toBe(STATUS_PAGE_PUBLISHED);
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
});
2020-07-28 23:09:34 +05:30
expect(findButtons()).toHaveLength(0);
2019-09-04 21:01:54 +05:30
});
});