BigW Consortium Gitlab

dropdown_action_component_spec.js 892 Bytes
Newer Older
1 2 3 4 5 6
import Vue from 'vue';
import dropdownActionComponent from '~/pipelines/components/graph/dropdown_action_component.vue';

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

Phil Hughes committed
7
  beforeEach((done) => {
8 9 10 11 12 13 14 15 16
    const DropdownActionComponent = Vue.extend(dropdownActionComponent);
    component = new DropdownActionComponent({
      propsData: {
        tooltipText: 'bar',
        link: 'foo',
        actionMethod: 'post',
        actionIcon: 'icon_action_cancel',
      },
    }).$mount();
Phil Hughes committed
17 18

    Vue.nextTick(done);
19 20 21 22 23 24 25 26 27 28 29 30 31 32
  });

  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();
  });
});