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

toolbar_item_spec.js « rich_content_editor « components « vue_shared « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8545c43dc1e7cca70dfc2d663d86351ac404d99d (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
import { shallowMount } from '@vue/test-utils';
import { GlIcon } from '@gitlab/ui';
import ToolbarItem from '~/vue_shared/components/rich_content_editor/toolbar_item.vue';

describe('Toolbar Item', () => {
  let wrapper;

  const findIcon = () => wrapper.find(GlIcon);
  const findButton = () => wrapper.find('button');

  const buildWrapper = propsData => {
    wrapper = shallowMount(ToolbarItem, { propsData });
  };

  describe.each`
    icon
    ${'heading'}
    ${'bold'}
    ${'italic'}
    ${'strikethrough'}
    ${'quote'}
    ${'link'}
    ${'doc-code'}
    ${'list-bulleted'}
    ${'list-numbered'}
    ${'list-task'}
    ${'list-indent'}
    ${'list-outdent'}
    ${'dash'}
    ${'table'}
    ${'code'}
  `('toolbar item component', ({ icon }) => {
    beforeEach(() => buildWrapper({ icon }));

    it('renders a toolbar button', () => {
      expect(findButton().exists()).toBe(true);
    });

    it(`renders the ${icon} icon`, () => {
      expect(findIcon().exists()).toBe(true);
      expect(findIcon().props().name).toBe(icon);
    });
  });
});