debian-mirror-gitlab/spec/javascripts/pipelines/pipelines_actions_spec.js

47 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-08-17 22:00:37 +05:30
import Vue from 'vue';
2017-09-10 17:25:29 +05:30
import pipelinesActionsComp from '~/pipelines/components/pipelines_actions.vue';
2017-08-17 22:00:37 +05:30
describe('Pipelines Actions dropdown', () => {
let component;
let actions;
let ActionsComponent;
beforeEach(() => {
ActionsComponent = Vue.extend(pipelinesActionsComp);
actions = [
{
name: 'stop_review',
path: '/root/review-app/builds/1893/play',
},
{
name: 'foo',
path: '#',
playable: false,
},
];
component = new ActionsComponent({
propsData: {
actions,
},
}).$mount();
});
it('should render a dropdown with the provided actions', () => {
expect(
component.$el.querySelectorAll('.dropdown-menu li').length,
).toEqual(actions.length);
});
it('should render a disabled action when it\'s not playable', () => {
expect(
component.$el.querySelector('.dropdown-menu li:last-child button').getAttribute('disabled'),
).toEqual('disabled');
expect(
component.$el.querySelector('.dropdown-menu li:last-child button').classList.contains('disabled'),
).toEqual(true);
});
});