Create Fieldset.spec.js
parent
787cbb374c
commit
93a0d4c099
|
@ -0,0 +1,31 @@
|
|||
import { mount } from '@vue/test-utils';
|
||||
import Fieldset from './Fieldset.vue';
|
||||
|
||||
describe('Fieldset.vue', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = mount(Fieldset, {
|
||||
props: {
|
||||
legend: 'Header',
|
||||
toggleable: true,
|
||||
collapsed: true
|
||||
},
|
||||
slots: {
|
||||
default: `<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>`
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should exist', () => {
|
||||
expect(wrapper.find('.p-fieldset.p-component').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-fieldset-legend').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-toggleable-content').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('toggleable check', async () => {
|
||||
await wrapper.setProps({ collapsed: false });
|
||||
wrapper.vm.toggle({});
|
||||
expect(wrapper.emitted()['update:collapsed'][0]).toEqual([true]);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue