import {mount} from '@vue/test-utils'; import Toggle from '@/components/ui/Toggle'; describe('Toggle.vue', () => { it.skip('should toggle the input value from true to false and back', async () => { //todo: fix this, started failing after upgrade vom jest@25 to jest@27, probably already at jest@26 let checked = false; const props = { label: 'Some toggle label', checked: checked, }; const wrapper = mount(Toggle, { propsData: props }); const label = wrapper.find('[data-cy=toggle-label]'); expect(label.text()).toContain('Some toggle label'); const input = wrapper.find('[data-cy=toggle-checkbox'); console.log(input.element); expect(input.element.checked).toBe(false); wrapper.trigger('click'); expect(input.element.checked).toBe(true); wrapper.trigger('click'); expect(input.element.checked).toBe(false); // expect(wrapper.emitted()['change-text'][0]).toEqual([inputText, props.index]); expect(wrapper.emitted().input.length).toBe(2); expect(wrapper.emitted().input).toEqual([[true], [false]]); }); });