gitlab-org--gitlab-foss/spec/frontend/pipelines/empty_state_spec.js

59 lines
1.6 KiB
JavaScript
Raw Normal View History

import Vue from 'vue';
import emptyStateComp from '~/pipelines/components/empty_state.vue';
import mountComponent from '../helpers/vue_mount_component_helper';
describe('Pipelines Empty State', () => {
let component;
let EmptyStateComponent;
beforeEach(() => {
EmptyStateComponent = Vue.extend(emptyStateComp);
component = mountComponent(EmptyStateComponent, {
helpPagePath: 'foo',
emptyStateSvgPath: 'foo',
canSetCi: true,
});
});
afterEach(() => {
component.$destroy();
});
it('should render empty state SVG', () => {
expect(component.$el.querySelector('.svg-content svg')).toBeDefined();
});
2018-10-30 06:53:01 -04:00
it('should render empty state information', () => {
expect(component.$el.querySelector('h4').textContent).toContain('Build with confidence');
expect(
2018-10-17 03:13:26 -04:00
component.$el
.querySelector('p')
.innerHTML.trim()
.replace(/\n+\s+/m, ' ')
.replace(/\s\s+/g, ' '),
2018-05-25 02:36:40 -04:00
).toContain('Continuous Integration can help catch bugs by running your tests automatically,');
expect(
2018-10-17 03:13:26 -04:00
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',
);
});
it('should render a link with provided help path', () => {
2018-10-17 03:13:26 -04:00
expect(component.$el.querySelector('.js-get-started-pipelines').getAttribute('href')).toEqual(
'foo',
);
2018-10-17 03:21:28 -04:00
2018-10-17 03:13:26 -04:00
expect(component.$el.querySelector('.js-get-started-pipelines').textContent).toContain(
'Get started with Pipelines',
);
});
});