summaryrefslogtreecommitdiff
path: root/spec/frontend/jira_connect/subscriptions/components/browser_support_alert_spec.js
blob: aa93a6be3c851793e5e9e5d7d44999a5bb193ce0 (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
import { GlAlert, GlLink } from '@gitlab/ui';
import { shallowMount, mount } from '@vue/test-utils';
import BrowserSupportAlert from '~/jira_connect/subscriptions/components/browser_support_alert.vue';

describe('BrowserSupportAlert', () => {
  let wrapper;

  const createComponent = ({ mountFn = shallowMount } = {}) => {
    wrapper = mountFn(BrowserSupportAlert);
  };

  const findAlert = () => wrapper.findComponent(GlAlert);
  const findLink = () => wrapper.findComponent(GlLink);

  afterEach(() => {
    wrapper.destroy();
  });

  it('displays a non-dismissible alert', () => {
    createComponent();

    expect(findAlert().exists()).toBe(true);
    expect(findAlert().props()).toMatchObject({
      dismissible: false,
      title: BrowserSupportAlert.i18n.title,
      variant: 'danger',
    });
  });

  it('renders help link with target="_blank" and rel="noopener noreferrer"', () => {
    createComponent({ mountFn: mount });
    expect(findLink().attributes()).toMatchObject({
      target: '_blank',
      rel: 'noopener',
    });
  });
});