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

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

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

  describe('tribute', () => {
    const mentions = '/gitlab-org/gitlab-test/-/autocomplete_sources/members?type=Issue&type_id=1';

    beforeEach(() => {
      wrapper = shallowMount(GfmAutocomplete, {
        propsData: {
          dataSources: {
            mentions,
          },
        },
        slots: {
          default: ['<input/>'],
        },
      });
    });

    it('is set to tribute instance variable', () => {
      expect(wrapper.vm.tribute instanceof Tribute).toBe(true);
    });

    it('contains the slot input element', () => {
      wrapper.find('input').setValue('@');

      expect(wrapper.vm.tribute.current.element).toBe(wrapper.find('input').element);
    });
  });
});