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

alert_summary_row_spec.js « alert_details « vue_shared « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a2981478954958bfb94bff37beb4e353f8e2504a (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 { shallowMount } from '@vue/test-utils';
import AlertSummaryRow from '~/vue_shared/alert_details/components/alert_summary_row.vue';

const label = 'a label';
const value = 'a value';

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

  function mountComponent({ mountMethod = shallowMount, props, defaultSlot } = {}) {
    wrapper = mountMethod(AlertSummaryRow, {
      propsData: props,
      scopedSlots: {
        default: defaultSlot,
      },
    });
  }

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

  describe('Alert Summary Row', () => {
    beforeEach(() => {
      mountComponent({
        props: {
          label,
        },
        defaultSlot: `<span class="value">${value}</span>`,
      });
    });

    it('should display a label and a value', () => {
      expect(wrapper.text()).toBe(`${label} ${value}`);
    });
  });
});