summaryrefslogtreecommitdiff
path: root/spec/javascripts/pipelines/graph/dropdown_action_component_spec.js
blob: 25fd18b197ee46ffd19f2fb2e05853f4798d0bce (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
import Vue from 'vue';
import dropdownActionComponent from '~/pipelines/components/graph/dropdown_action_component.vue';

describe('action component', () => {
  let component;

  beforeEach((done) => {
    const DropdownActionComponent = Vue.extend(dropdownActionComponent);
    component = new DropdownActionComponent({
      propsData: {
        tooltipText: 'bar',
        link: 'foo',
        actionMethod: 'post',
        actionIcon: 'icon_action_cancel',
      },
    }).$mount();

    Vue.nextTick(done);
  });

  it('should render a link', () => {
    expect(component.$el.getAttribute('href')).toEqual('foo');
  });

  it('should render the provided title as a bootstrap tooltip', () => {
    expect(component.$el.getAttribute('data-original-title')).toEqual('bar');
  });

  it('should render an svg', () => {
    expect(component.$el.querySelector('svg')).toBeDefined();
  });
});