debian-mirror-gitlab/spec/javascripts/cycle_analytics/banner_spec.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-03-17 18:26:18 +05:30
import Vue from 'vue';
2018-03-27 19:54:05 +05:30
import mountComponent from 'spec/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
describe('Cycle analytics banner', () => {
let vm;
beforeEach(() => {
const Component = Vue.extend(banner);
vm = mountComponent(Component, {
documentationLink: 'path',
});
});
afterEach(() => {
vm.$destroy();
});
it('should render cycle analytics information', () => {
2018-12-13 13:39:08 +05:30
expect(vm.$el.querySelector('h4').textContent.trim()).toEqual('Introducing Cycle 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(
'Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.',
);
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', () => {
spyOn(vm, '$emit');
vm.$el.querySelector('.js-ca-dismiss-button').click();
expect(vm.$emit).toHaveBeenCalled();
});
});