summaryrefslogtreecommitdiff
path: root/spec/frontend/vue_shared/components/design_management/design_note_pin_spec.js
blob: 984a28c93d6b1e179ae55ba4c1cec3c46b290ea7 (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
import { shallowMount } from '@vue/test-utils';
import DesignNotePin from '~/vue_shared/components/design_management/design_note_pin.vue';

describe('Design note pin component', () => {
  let wrapper;

  function createComponent(propsData = {}) {
    wrapper = shallowMount(DesignNotePin, {
      propsData: {
        position: {
          left: '10px',
          top: '10px',
        },
        ...propsData,
      },
    });
  }

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

  it('should match the snapshot of note without index', () => {
    createComponent();
    expect(wrapper.element).toMatchSnapshot();
  });

  it('should match the snapshot of note with index', () => {
    createComponent({ label: 1 });
    expect(wrapper.element).toMatchSnapshot();
  });

  it('should match the snapshot when pin is resolved', () => {
    createComponent({ isResolved: true });
    expect(wrapper.element).toMatchSnapshot();
  });

  it('should match the snapshot when position is absent', () => {
    createComponent({ position: null });
    expect(wrapper.element).toMatchSnapshot();
  });
});