2017-08-17 22:00:37 +05:30
|
|
|
import Vue from 'vue';
|
2017-09-10 17:25:29 +05:30
|
|
|
import artifactsComp from '~/pipelines/components/pipelines_artifacts.vue';
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
describe('Pipelines Artifacts dropdown', () => {
|
|
|
|
let component;
|
|
|
|
let artifacts;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const ArtifactsComponent = Vue.extend(artifactsComp);
|
|
|
|
|
|
|
|
artifacts = [
|
|
|
|
{
|
|
|
|
name: 'artifact',
|
|
|
|
path: '/download/path',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
component = new ArtifactsComponent({
|
|
|
|
propsData: {
|
|
|
|
artifacts,
|
|
|
|
},
|
|
|
|
}).$mount();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a dropdown with the provided artifacts', () => {
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(component.$el.querySelectorAll('.dropdown-menu li').length).toEqual(artifacts.length);
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a link with the provided path', () => {
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(component.$el.querySelector('.dropdown-menu li a').getAttribute('href')).toEqual(
|
|
|
|
artifacts[0].path,
|
|
|
|
);
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(component.$el.querySelector('.dropdown-menu li a').textContent).toContain(
|
|
|
|
artifacts[0].name,
|
|
|
|
);
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
});
|