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

work_item_actions_split_button_spec.js « work_item_links « components « work_items « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 630ffa1a699501211c6b9706bd59f6d60d6c6259 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { GlDisclosureDropdown, GlDisclosureDropdownGroup } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';

import WorkItemActionsSplitButton from '~/work_items/components/work_item_links/work_item_actions_split_button.vue';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';

const okrActions = [
  {
    name: 'Objective',
    items: [
      {
        text: 'New objective',
      },
      {
        text: 'Existing objective',
      },
    ],
  },
  {
    name: 'Key result',
    items: [
      {
        text: 'New key result',
      },
      {
        text: 'Existing key result',
      },
    ],
  },
];

const createComponent = () => {
  return extendedWrapper(
    shallowMount(WorkItemActionsSplitButton, {
      propsData: {
        actions: okrActions,
      },
      stubs: {
        GlDisclosureDropdown,
      },
    }),
  );
};

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

  beforeEach(() => {
    wrapper = createComponent();
  });

  describe('WorkItemActionsSplitButton', () => {
    describe('template', () => {
      it('renders objective and key results sections', () => {
        expect(wrapper.findAllComponents(GlDisclosureDropdownGroup).at(0).props('group').name).toBe(
          'Objective',
        );

        expect(wrapper.findAllComponents(GlDisclosureDropdownGroup).at(1).props('group').name).toBe(
          'Key result',
        );
      });
    });
  });
});