2017-08-17 22:00:37 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import emptyStateComp from '~/pipelines/components/empty_state.vue';
|
2018-03-27 19:54:05 +05:30
|
|
|
import mountComponent from '../helpers/vue_mount_component_helper';
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
describe('Pipelines Empty State', () => {
|
|
|
|
let component;
|
|
|
|
let EmptyStateComponent;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
EmptyStateComponent = Vue.extend(emptyStateComp);
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
component = mountComponent(EmptyStateComponent, {
|
|
|
|
helpPagePath: 'foo',
|
|
|
|
emptyStateSvgPath: 'foo',
|
|
|
|
canSetCi: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
component.$destroy();
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('should render empty state SVG', () => {
|
|
|
|
expect(component.$el.querySelector('.svg-content svg')).toBeDefined();
|
|
|
|
});
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
it('should render empty state information', () => {
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(component.$el.querySelector('h4').textContent).toContain('Build with confidence');
|
|
|
|
|
|
|
|
expect(
|
2018-12-13 13:39:08 +05:30
|
|
|
component.$el
|
|
|
|
.querySelector('p')
|
|
|
|
.innerHTML.trim()
|
|
|
|
.replace(/\n+\s+/m, ' ')
|
|
|
|
.replace(/\s\s+/g, ' '),
|
2018-11-08 19:23:39 +05:30
|
|
|
).toContain('Continuous Integration can help catch bugs by running your tests automatically,');
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
expect(
|
2018-12-13 13:39:08 +05:30
|
|
|
component.$el
|
|
|
|
.querySelector('p')
|
|
|
|
.innerHTML.trim()
|
|
|
|
.replace(/\n+\s+/m, ' ')
|
|
|
|
.replace(/\s\s+/g, ' '),
|
|
|
|
).toContain(
|
|
|
|
'while Continuous Deployment can help you deliver code to your product environment',
|
|
|
|
);
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a link with provided help path', () => {
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(component.$el.querySelector('.js-get-started-pipelines').getAttribute('href')).toEqual(
|
|
|
|
'foo',
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(component.$el.querySelector('.js-get-started-pipelines').textContent).toContain(
|
|
|
|
'Get started with Pipelines',
|
|
|
|
);
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
});
|