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

33 lines
791 B
JavaScript
Raw Normal View History

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();
});
2019-02-15 15:39:39 +05:30
it('renders a collapsed 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();
});
});
});