Create InputSwitch.spec.js

pull/2334/head
Tuğçe Küçükoğlu 2022-03-17 17:14:41 +03:00
parent b385475d84
commit ff32a760f4
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
import { mount } from '@vue/test-utils';
import InputSwitch from './InputSwitch.vue';
describe('InputSwitch.vue', () => {
it('should exist', async () => {
const wrapper = mount(InputSwitch);
expect(wrapper.find('.p-inputswitch.p-component').exists()).toBe(true);
expect(wrapper.find('.p-inputswitch-slider').exists()).toBe(true);
await wrapper.trigger('click');
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([true]);
await wrapper.setProps({ modelValue: true });
expect(wrapper.vm.checked).toBe(true);
expect(wrapper.find('.p-inputswitch').classes()).toContain('p-inputswitch-checked');
});
});