diff options
Diffstat (limited to 'ui/tests/lib/components/ChangePassword.svelte.test.js')
| -rw-r--r-- | ui/tests/lib/components/ChangePassword.svelte.test.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ui/tests/lib/components/ChangePassword.svelte.test.js b/ui/tests/lib/components/ChangePassword.svelte.test.js new file mode 100644 index 0000000..6e0e652 --- /dev/null +++ b/ui/tests/lib/components/ChangePassword.svelte.test.js @@ -0,0 +1,28 @@ +// 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('<button>0</button>'); + + // Click the button, then flush the changes so you can synchronously write expectations + document.body.querySelector('button').click(); + flushSync(); + + expect(document.body.innerHTML).toBe('<button>1</button>'); + + // Remove the component from the DOM + unmount(component); +}); +/* */ |
