2022-09-06 12:03:37 +00:00
|
|
|
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);
|
|
|
|
|
2024-01-18 08:14:47 +00:00
|
|
|
await wrapper.vm.onChange({});
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([true]);
|
|
|
|
|
|
|
|
await wrapper.setProps({ modelValue: true });
|
|
|
|
|
|
|
|
expect(wrapper.vm.checked).toBe(true);
|
2024-01-18 08:14:47 +00:00
|
|
|
expect(wrapper.find('.p-inputswitch').classes()).toContain('p-highlight');
|
2022-09-06 12:03:37 +00:00
|
|
|
});
|
2022-09-14 11:26:01 +00:00
|
|
|
});
|