2018-03-17 18:26:18 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import expandButton from '~/vue_shared/components/expand_button.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('expand button', () => {
|
2018-10-15 14:42:47 +05:30
|
|
|
const Component = Vue.extend(expandButton);
|
2018-03-17 18:26:18 +05:30
|
|
|
let vm;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
vm = mountComponent(Component, {
|
|
|
|
slots: {
|
|
|
|
expanded: '<p>Expanded!</p>',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a collpased button', () => {
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(vm.$children[0].iconTestClass).toEqual('ic-ellipsis_h');
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
it('hides expander on click', done => {
|
2018-03-17 18:26:18 +05:30
|
|
|
vm.$el.querySelector('button').click();
|
|
|
|
vm.$nextTick(() => {
|
|
|
|
expect(vm.$el.querySelector('button').getAttribute('style')).toEqual('display: none;');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|