summaryrefslogtreecommitdiff
path: root/spec/javascripts/issue_show/components/fields/title_spec.js
blob: 117a8b511471b6a1b0fcadd4112ee6f49a7c918b (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
66
import Vue from 'vue';
import Store from '~/issue_show/stores';
import titleField from '~/issue_show/components/fields/title.vue';
<<<<<<< HEAD
<<<<<<< HEAD
import '~/templates/issuable_template_selectors';
=======
>>>>>>> b1affe0... Issue inline edit title field
=======
>>>>>>> 3301ca1... Fixed up the template dropdown to correctly work

describe('Title field component', () => {
  let vm;
  let store;

  beforeEach(() => {
    const Component = Vue.extend(titleField);
    store = new Store({
      titleHtml: '',
      descriptionHtml: '',
      issuableRef: '',
    });
    store.formState.title = 'test';

    vm = new Component({
      propsData: {
<<<<<<< HEAD
        formState: store.formState,
=======
        store,
>>>>>>> b1affe0... Issue inline edit title field
      },
    }).$mount();
  });

  it('renders form control with formState title', () => {
    expect(
      vm.$el.querySelector('.form-control').value,
    ).toBe('test');
  });
<<<<<<< HEAD
<<<<<<< HEAD

  it('does not render template selector if no templates exist', () => {
    expect(
      vm.$el.querySelector('.js-issuable-selector-wrap'),
    ).toBeNull();
  });

  it('renders template selector when templates exists', (done) => {
    spyOn(gl, 'IssuableTemplateSelectors');
    vm.issuableTemplates = ['test'];

    Vue.nextTick(() => {
      expect(
        vm.$el.querySelector('.js-issuable-selector-wrap'),
      ).not.toBeNull();

      done();
    });
  });
=======
>>>>>>> b1affe0... Issue inline edit title field
=======
>>>>>>> 3301ca1... Fixed up the template dropdown to correctly work
});