2017-03-17 13:30:32 -04:00
|
|
|
import Vue from 'vue';
|
2017-06-14 09:04:50 -04:00
|
|
|
import artifactsComp from '~/pipelines/components/pipelines_artifacts.vue';
|
2017-03-17 13:30:32 -04:00
|
|
|
|
|
|
|
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-10-17 03:13:26 -04:00
|
|
|
expect(component.$el.querySelectorAll('.dropdown-menu li').length).toEqual(artifacts.length);
|
2017-03-17 13:30:32 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a link with the provided path', () => {
|
2018-10-17 03:13:26 -04:00
|
|
|
expect(component.$el.querySelector('.dropdown-menu li a').getAttribute('href')).toEqual(
|
|
|
|
artifacts[0].path,
|
|
|
|
);
|
2017-03-17 13:30:32 -04:00
|
|
|
|
2018-10-17 03:13:26 -04:00
|
|
|
expect(component.$el.querySelector('.dropdown-menu li a').textContent).toContain(
|
|
|
|
artifacts[0].name,
|
|
|
|
);
|
2017-03-17 13:30:32 -04:00
|
|
|
});
|
|
|
|
});
|