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', () => {
|
|
|
|
let vm;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const Component = Vue.extend(expandButton);
|
|
|
|
vm = mountComponent(Component, {
|
|
|
|
slots: {
|
|
|
|
expanded: '<p>Expanded!</p>',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a collpased button', () => {
|
|
|
|
expect(vm.$el.textContent.trim()).toEqual('...');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('hides expander on click', (done) => {
|
|
|
|
vm.$el.querySelector('button').click();
|
|
|
|
vm.$nextTick(() => {
|
|
|
|
expect(vm.$el.querySelector('button').getAttribute('style')).toEqual('display: none;');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|