2018-03-17 18:26:18 +05:30
|
|
|
import Vue from 'vue';
|
2020-04-22 19:07:51 +05:30
|
|
|
import mountComponent from 'helpers/vue_mount_component_helper';
|
2020-01-01 13:55:28 +05:30
|
|
|
import banner from '~/cycle_analytics/components/banner.vue';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
describe('Value Stream Analytics banner', () => {
|
2018-03-17 18:26:18 +05:30
|
|
|
let vm;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const Component = Vue.extend(banner);
|
|
|
|
vm = mountComponent(Component, {
|
|
|
|
documentationLink: 'path',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
it('should render value stream analytics information', () => {
|
|
|
|
expect(vm.$el.querySelector('h4').textContent.trim()).toEqual(
|
|
|
|
'Introducing Value Stream Analytics',
|
|
|
|
);
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
expect(
|
2018-12-13 13:39:08 +05:30
|
|
|
vm.$el
|
|
|
|
.querySelector('p')
|
|
|
|
.textContent.trim()
|
|
|
|
.replace(/[\r\n]+/g, ' '),
|
|
|
|
).toContain(
|
2020-03-13 15:44:24 +05:30
|
|
|
'Value Stream Analytics gives an overview of how much time it takes to go from idea to production in your project.',
|
2018-12-13 13:39:08 +05:30
|
|
|
);
|
|
|
|
|
|
|
|
expect(vm.$el.querySelector('a').textContent.trim()).toEqual('Read more');
|
|
|
|
|
|
|
|
expect(vm.$el.querySelector('a').getAttribute('href')).toEqual('path');
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('should emit an event when close button is clicked', () => {
|
2020-04-22 19:07:51 +05:30
|
|
|
jest.spyOn(vm, '$emit').mockImplementation(() => {});
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
vm.$el.querySelector('.js-ca-dismiss-button').click();
|
|
|
|
|
|
|
|
expect(vm.$emit).toHaveBeenCalled();
|
|
|
|
});
|
|
|
|
});
|