Refactor #5612 - InputSwitch / ToggleSwitch

This commit is contained in:
tugcekucukoglu 2024-04-18 17:15:29 +03:00
parent 1428cc12df
commit f240b953b4
16 changed files with 384 additions and 263 deletions

View file

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