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

child_content_spec.js « extensions « components « vue_mr_widget « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 198a4c2823af0bdb7fc580f70b83cf8f0d52ef72 (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 ChildContent from '~/vue_merge_request_widget/components/extensions/child_content.vue';

let wrapper;
const mockData = () => ({
  header: 'Test header',
  text: 'Test content',
  icon: {
    name: 'error',
  },
});

function factory(propsData) {
  wrapper = shallowMount(ChildContent, {
    propsData: {
      ...propsData,
      widgetLabel: 'Test',
    },
  });
}

describe('MR widget extension child content', () => {
  afterEach(() => {
    wrapper.destroy();
    wrapper = null;
  });

  it('renders child components', () => {
    factory({
      data: {
        ...mockData(),
        children: [mockData()],
      },
      level: 2,
    });

    expect(wrapper.find('[data-testid="child-content"]').exists()).toBe(true);
    expect(wrapper.find('[data-testid="child-content"]').props('level')).toBe(3);
  });
});