Create Fieldset.spec.js

pull/2305/head
Tuğçe Küçükoğlu 2022-03-10 13:39:32 +03:00 committed by Tuğçe Küçükoğlu
parent 787cbb374c
commit 93a0d4c099
1 changed files with 31 additions and 0 deletions

View File

@ -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]);
});
});