summaryrefslogtreecommitdiff
path: root/spec/frontend/issue_show/components/pinned_links_spec.js
blob: 77da3390918471722cb204be314eb4edb3c3c84b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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: {
        zoomMeetingUrl: null,
        ...props,
      },
    });
  };

  it('displays Zoom link', () => {
    createComponent({
      zoomMeetingUrl: `<a href="${plainZoomUrl}">Zoom</a>`,
    });

    expect(link.text).toBe('Join Zoom meeting');
  });

  it('does not render if there are no links', () => {
    createComponent({
      zoomMeetingUrl: null,
    });

    expect(wrapper.find(GlLink).exists()).toBe(false);
  });
});