2018-01-03 21:03:39 +00:00
|
|
|
import Vue from 'vue';
|
|
|
|
import expandButton from '~/vue_shared/components/expand_button.vue';
|
2018-02-26 19:43:34 +00:00
|
|
|
import mountComponent from 'spec/helpers/vue_mount_component_helper';
|
2018-01-03 21:03:39 +00:00
|
|
|
|
|
|
|
describe('expand button', () => {
|
2018-04-19 15:07:11 +00:00
|
|
|
const Component = Vue.extend(expandButton);
|
2018-01-03 21:03:39 +00:00
|
|
|
let vm;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
vm = mountComponent(Component, {
|
|
|
|
slots: {
|
|
|
|
expanded: '<p>Expanded!</p>',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
|
2018-11-15 10:04:25 +00:00
|
|
|
it('renders a collapsed button', () => {
|
2018-06-20 07:36:50 +00:00
|
|
|
expect(vm.$children[0].iconTestClass).toEqual('ic-ellipsis_h');
|
2018-01-03 21:03:39 +00:00
|
|
|
});
|
|
|
|
|
2018-04-19 15:07:11 +00:00
|
|
|
it('hides expander on click', done => {
|
2018-01-03 21:03:39 +00:00
|
|
|
vm.$el.querySelector('button').click();
|
|
|
|
vm.$nextTick(() => {
|
|
|
|
expect(vm.$el.querySelector('button').getAttribute('style')).toEqual('display: none;');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|