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

status_icon_spec.js « extensions « components « vue_merge_request_widget « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f3aa5bb774f2392f3e07718a10afb759d4fc9549 (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
import { GlIcon, GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import StatusIcon from '~/vue_merge_request_widget/components/extensions/status_icon.vue';

let wrapper;

function factory(propsData = {}) {
  wrapper = shallowMount(StatusIcon, {
    propsData,
  });
}

describe('MR widget extensions status icon', () => {
  afterEach(() => {
    wrapper.destroy();
  });

  it('renders loading icon', () => {
    factory({ name: 'test', isLoading: true, iconName: 'failed' });

    expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true);
  });

  it('renders status icon', () => {
    factory({ name: 'test', isLoading: false, iconName: 'failed' });

    expect(wrapper.findComponent(GlIcon).exists()).toBe(true);
    expect(wrapper.findComponent(GlIcon).props('name')).toBe('status-failed');
  });

  it('sets aria-label for status icon', () => {
    factory({ name: 'test', isLoading: false, iconName: 'failed' });

    expect(wrapper.findComponent(GlIcon).props('ariaLabel')).toBe('Failed test');
  });
});