2018-03-17 18:26:18 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import collapsedCalendarIcon from '~/vue_shared/components/sidebar/collapsed_calendar_icon.vue';
|
2018-03-27 19:54:05 +05:30
|
|
|
import mountComponent from 'spec/helpers/vue_mount_component_helper';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
describe('collapsedCalendarIcon', () => {
|
|
|
|
let vm;
|
|
|
|
beforeEach(() => {
|
|
|
|
const CollapsedCalendarIcon = Vue.extend(collapsedCalendarIcon);
|
|
|
|
vm = mountComponent(CollapsedCalendarIcon, {
|
|
|
|
containerClass: 'test-class',
|
|
|
|
text: 'text',
|
|
|
|
showIcon: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should add class to container', () => {
|
|
|
|
expect(vm.$el.classList.contains('test-class')).toEqual(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should hide calendar icon if showIcon', () => {
|
|
|
|
expect(vm.$el.querySelector('.fa-calendar')).toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render text', () => {
|
|
|
|
expect(vm.$el.querySelector('span').innerText.trim()).toEqual('text');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should emit click event when container is clicked', () => {
|
|
|
|
const click = jasmine.createSpy();
|
|
|
|
vm.$on('click', click);
|
|
|
|
|
|
|
|
vm.$el.click();
|
|
|
|
expect(click).toHaveBeenCalled();
|
|
|
|
});
|
|
|
|
});
|