Welcome to mirror list, hosted at ThFree Co, Russian Federation.

diagram_performance_warning_spec.js « components « behaviors « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c58c2bc55a9a9bc4b16f376ae28ee3b265efee21 (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
import { GlAlert } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import DiagramPerformanceWarning from '~/behaviors/components/diagram_performance_warning.vue';

describe('DiagramPerformanceWarning component', () => {
  let wrapper;

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

  beforeEach(() => {
    wrapper = shallowMount(DiagramPerformanceWarning);
  });

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

  it('renders warning alert with button', () => {
    expect(findAlert().props()).toMatchObject({
      primaryButtonText: DiagramPerformanceWarning.i18n.buttonText,
      variant: 'warning',
    });
  });

  it('renders warning message', () => {
    expect(findAlert().text()).toBe(DiagramPerformanceWarning.i18n.bodyText);
  });

  it('emits event when closing alert', () => {
    findAlert().vm.$emit('dismiss');

    expect(wrapper.emitted('closeAlert')).toEqual([[]]);
  });

  it('emits event when accepting alert', () => {
    findAlert().vm.$emit('primaryAction');

    expect(wrapper.emitted('showImage')).toEqual([[]]);
  });
});