// async onsubmit(event) // // Example: /* */ import { flushSync, mount, unmount } from 'svelte'; import { expect, test } from 'vitest'; import ChangePassword from '$lib/components/ChangePassword.svelte'; test('ChangePassword', () => { // Instantiate the component using Svelte's `mount` API const component = mount(ChangePassword, { target: document.body, // `document` exists because of jsdom props: { initial: 0 } }); expect(document.body.innerHTML).toBe(''); // Click the button, then flush the changes so you can synchronously write expectations document.body.querySelector('button').click(); flushSync(); expect(document.body.innerHTML).toBe(''); // Remove the component from the DOM unmount(component); }); /* */