summaryrefslogtreecommitdiff
path: root/spec/javascripts/vue_mr_widget/components/states/mr_widget_locked_spec.js
blob: 237035648cf82334f337350f687233035e317a50 (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
import Vue from 'vue';
import mergingComponent from '~/vue_merge_request_widget/components/states/mr_widget_merging';

describe('MRWidgetMerging', () => {
  describe('props', () => {
    it('should have props', () => {
      const { mr } = mergingComponent.props;

      expect(mr.type instanceof Object).toBeTruthy();
      expect(mr.required).toBeTruthy();
    });
  });

  describe('template', () => {
    it('should have correct elements', () => {
      const Component = Vue.extend(mergingComponent);
      const mr = {
        targetBranchPath: '/branch-path',
        targetBranch: 'branch',
      };
      const el = new Component({
        el: document.createElement('div'),
        propsData: { mr },
      }).$el;

      expect(el.classList.contains('mr-widget-body')).toBeTruthy();
      expect(el.innerText).toContain('This merge request is in the process of being merged');
      expect(el.innerText).toContain('changes will be merged into');
      expect(el.querySelector('.label-branch a').getAttribute('href')).toEqual(mr.targetBranchPath);
      expect(el.querySelector('.label-branch a').textContent).toContain(mr.targetBranch);
    });
  });
});