Skip to content

Commit

Permalink
fix: fixed event reassignment on update and removed slot tests for v4
Browse files Browse the repository at this point in the history
  • Loading branch information
shfx committed Feb 24, 2025
1 parent 642b074 commit 1a47fc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
6 changes: 6 additions & 0 deletions packages/playwright-ct-svelte/registerSource.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ window.playwrightMount = async (component, rootElement, hooksConfig) => {

for (const hook of window.__pw_hooks_after_mount || [])
await hook({ hooksConfig, svelteComponent });

for (const [key, listener] of Object.entries(component.on || {}))
svelteComponent.$on(key, event => listener(event.detail));
};

window.playwrightUnmount = async rootElement => {
Expand All @@ -111,4 +114,7 @@ window.playwrightUpdate = async (rootElement, component) => {
throw new Error('Component was not mounted');

svelteComponent.$set(extractParams(component));

for (const [key, listener] of Object.entries(component.on || {}))
svelteComponent.$on(key, event => listener(event.detail));
};
25 changes: 0 additions & 25 deletions tests/components/ct-svelte4/tests/slots.spec.ts

This file was deleted.

0 comments on commit 1a47fc3

Please sign in to comment.