2017-05-06 13:02:06 -04:00
|
|
|
import Vue from 'vue';
|
|
|
|
import actionComponent from '~/pipelines/components/graph/action_component.vue';
|
|
|
|
|
|
|
|
describe('pipeline graph action component', () => {
|
|
|
|
let component;
|
|
|
|
|
2017-05-24 07:42:23 -04:00
|
|
|
beforeEach((done) => {
|
2017-05-06 13:02:06 -04:00
|
|
|
const ActionComponent = Vue.extend(actionComponent);
|
|
|
|
component = new ActionComponent({
|
|
|
|
propsData: {
|
|
|
|
tooltipText: 'bar',
|
|
|
|
link: 'foo',
|
|
|
|
actionMethod: 'post',
|
2017-10-05 17:16:37 -04:00
|
|
|
actionIcon: 'cancel',
|
2017-05-06 13:02:06 -04:00
|
|
|
},
|
|
|
|
}).$mount();
|
2017-05-24 07:42:23 -04:00
|
|
|
|
|
|
|
Vue.nextTick(done);
|
2017-05-06 13:02:06 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
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 update bootstrap tooltip when title changes', (done) => {
|
|
|
|
component.tooltipText = 'changed';
|
|
|
|
|
2017-05-24 07:42:23 -04:00
|
|
|
setTimeout(() => {
|
2017-05-06 13:02:06 -04:00
|
|
|
expect(component.$el.getAttribute('data-original-title')).toBe('changed');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render an svg', () => {
|
|
|
|
expect(component.$el.querySelector('.ci-action-icon-wrapper')).toBeDefined();
|
|
|
|
expect(component.$el.querySelector('svg')).toBeDefined();
|
|
|
|
});
|
|
|
|
});
|