Revert "Merge branch 'winh-mr-widget-no-pipeline' into 'master'"
This reverts merge request !12127
This commit is contained in:
parent
050eae8c4d
commit
9786e4fb0a
|
@ -17,9 +17,6 @@ export default {
|
||||||
|
|
||||||
return hasCI && !ciStatus;
|
return hasCI && !ciStatus;
|
||||||
},
|
},
|
||||||
hasPipeline() {
|
|
||||||
return Object.keys(this.mr.pipeline || {}).length > 0;
|
|
||||||
},
|
|
||||||
svg() {
|
svg() {
|
||||||
return statusIconEntityMap.icon_status_failed;
|
return statusIconEntityMap.icon_status_failed;
|
||||||
},
|
},
|
||||||
|
@ -33,11 +30,7 @@ export default {
|
||||||
template: `
|
template: `
|
||||||
<div class="mr-widget-heading">
|
<div class="mr-widget-heading">
|
||||||
<div class="ci-widget">
|
<div class="ci-widget">
|
||||||
<template v-if="!hasPipeline">
|
<template v-if="hasCIError">
|
||||||
<i class="fa fa-spinner fa-spin append-right-10" aria-hidden="true"></i>
|
|
||||||
Waiting for pipeline...
|
|
||||||
</template>
|
|
||||||
<template v-else-if="hasCIError">
|
|
||||||
<div class="ci-status-icon ci-status-icon-failed ci-error js-ci-error">
|
<div class="ci-status-icon ci-status-icon-failed ci-error js-ci-error">
|
||||||
<span class="js-icon-link icon-link">
|
<span class="js-icon-link icon-link">
|
||||||
<span
|
<span
|
||||||
|
|
|
@ -76,28 +76,6 @@ describe('MRWidgetPipeline', () => {
|
||||||
el = vm.$el;
|
el = vm.$el;
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
vm.$destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('without a pipeline', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
vm.mr = { pipeline: null };
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render message with spinner', (done) => {
|
|
||||||
Vue.nextTick()
|
|
||||||
.then(() => {
|
|
||||||
expect(el.querySelector('.pipeline-id')).toBe(null);
|
|
||||||
expect(el.innerText.trim()).toBe('Waiting for pipeline...');
|
|
||||||
expect(el.querySelectorAll('i.fa.fa-spinner.fa-spin').length).toBe(1);
|
|
||||||
done();
|
|
||||||
})
|
|
||||||
.then(done)
|
|
||||||
.catch(done.fail);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render template elements correctly', () => {
|
it('should render template elements correctly', () => {
|
||||||
expect(el.classList.contains('mr-widget-heading')).toBeTruthy();
|
expect(el.classList.contains('mr-widget-heading')).toBeTruthy();
|
||||||
expect(el.querySelectorAll('.ci-status-icon.ci-status-icon-success').length).toEqual(1);
|
expect(el.querySelectorAll('.ci-status-icon.ci-status-icon-success').length).toEqual(1);
|
||||||
|
@ -115,47 +93,39 @@ describe('MRWidgetPipeline', () => {
|
||||||
it('should list single stage', (done) => {
|
it('should list single stage', (done) => {
|
||||||
pipeline.details.stages.splice(0, 1);
|
pipeline.details.stages.splice(0, 1);
|
||||||
|
|
||||||
Vue.nextTick()
|
Vue.nextTick(() => {
|
||||||
.then(() => {
|
|
||||||
expect(el.querySelectorAll('.stage-container button').length).toEqual(1);
|
expect(el.querySelectorAll('.stage-container button').length).toEqual(1);
|
||||||
expect(el.innerText).toContain('with stage');
|
expect(el.innerText).toContain('with stage');
|
||||||
})
|
done();
|
||||||
.then(done)
|
});
|
||||||
.catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not have stages when there is no stage', (done) => {
|
it('should not have stages when there is no stage', (done) => {
|
||||||
vm.mr.pipeline.details.stages = [];
|
vm.mr.pipeline.details.stages = [];
|
||||||
|
|
||||||
Vue.nextTick()
|
Vue.nextTick(() => {
|
||||||
.then(() => {
|
|
||||||
expect(el.querySelectorAll('.stage-container button').length).toEqual(0);
|
expect(el.querySelectorAll('.stage-container button').length).toEqual(0);
|
||||||
})
|
done();
|
||||||
.then(done)
|
});
|
||||||
.catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not have coverage text when pipeline has no coverage info', (done) => {
|
it('should not have coverage text when pipeline has no coverage info', (done) => {
|
||||||
vm.mr.pipeline.coverage = null;
|
vm.mr.pipeline.coverage = null;
|
||||||
|
|
||||||
Vue.nextTick()
|
Vue.nextTick(() => {
|
||||||
.then(() => {
|
|
||||||
expect(el.querySelector('.js-mr-coverage')).toEqual(null);
|
expect(el.querySelector('.js-mr-coverage')).toEqual(null);
|
||||||
})
|
done();
|
||||||
.then(done)
|
});
|
||||||
.catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show CI error when there is a CI error', (done) => {
|
it('should show CI error when there is a CI error', (done) => {
|
||||||
vm.mr.ciStatus = null;
|
vm.mr.ciStatus = null;
|
||||||
|
|
||||||
Vue.nextTick()
|
Vue.nextTick(() => {
|
||||||
.then(() => {
|
|
||||||
expect(el.querySelectorAll('.js-ci-error').length).toEqual(1);
|
expect(el.querySelectorAll('.js-ci-error').length).toEqual(1);
|
||||||
expect(el.innerText).toContain('Could not connect to the CI server');
|
expect(el.innerText).toContain('Could not connect to the CI server');
|
||||||
})
|
done();
|
||||||
.then(done)
|
});
|
||||||
.catch(done.fail);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue