mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-11 01:42:34 +00:00
Refactor #5612 - InputSwitch / ToggleSwitch
This commit is contained in:
parent
1428cc12df
commit
f240b953b4
16 changed files with 384 additions and 263 deletions
20
components/lib/toggleswitch/ToggleSwitch.spec.js
Normal file
20
components/lib/toggleswitch/ToggleSwitch.spec.js
Normal 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');
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue