debian-mirror-gitlab/spec/javascripts/vue_shared/components/pikaday_spec.js

31 lines
840 B
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 datePicker from '~/vue_shared/components/pikaday.vue';
2018-03-17 18:26:18 +05:30
describe('datePicker', () => {
let vm;
beforeEach(() => {
const DatePicker = Vue.extend(datePicker);
vm = mountComponent(DatePicker, {
label: 'label',
});
});
it('should render label text', () => {
expect(vm.$el.querySelector('.dropdown-toggle-text').innerText.trim()).toEqual('label');
});
it('should show calendar', () => {
expect(vm.$el.querySelector('.pika-single')).toBeDefined();
});
it('should toggle when dropdown is clicked', () => {
const hidePicker = jasmine.createSpy();
vm.$on('hidePicker', hidePicker);
vm.$el.querySelector('.dropdown-menu-toggle').click();
2018-12-13 13:39:08 +05:30
2018-03-17 18:26:18 +05:30
expect(hidePicker).toHaveBeenCalled();
});
});