-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: 🔧 add patch package and jsdom
- Loading branch information
Showing
3 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/svead/patches/@testing-library+svelte+4.0.5.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
diff --git a/node_modules/@testing-library/svelte/src/pure.js b/node_modules/@testing-library/svelte/src/pure.js | ||
index 04d3cb0..2f041e0 100644 | ||
--- a/node_modules/@testing-library/svelte/src/pure.js | ||
+++ b/node_modules/@testing-library/svelte/src/pure.js | ||
@@ -3,7 +3,7 @@ import { | ||
getQueriesForElement, | ||
prettyDOM | ||
} from '@testing-library/dom' | ||
-import { tick } from 'svelte' | ||
+import { tick, createRoot } from 'svelte' | ||
|
||
const containerCache = new Set() | ||
const componentCache = new Set() | ||
@@ -54,18 +54,15 @@ const render = ( | ||
return { props: options } | ||
} | ||
|
||
- let component = new ComponentConstructor({ | ||
+ let component = createRoot(ComponentConstructor, { | ||
target, | ||
- ...checkProps(options) | ||
+ ...checkProps(options), | ||
+ ondestroy: () => componentCache.delete(component) | ||
}) | ||
|
||
containerCache.add({ container, target, component }) | ||
componentCache.add(component) | ||
|
||
- component.$$.on_destroy.push(() => { | ||
- componentCache.delete(component) | ||
- }) | ||
- | ||
return { | ||
container, | ||
component, | ||
@@ -73,18 +70,14 @@ const render = ( | ||
rerender: (options) => { | ||
if (componentCache.has(component)) component.$destroy() | ||
|
||
- // eslint-disable-next-line no-new | ||
- component = new ComponentConstructor({ | ||
+ component = createRoot(ComponentConstructor, { | ||
target, | ||
- ...checkProps(options) | ||
+ ...checkProps(options), | ||
+ ondestroy: () => componentCache.delete(component) | ||
}) | ||
|
||
containerCache.add({ container, target, component }) | ||
componentCache.add(component) | ||
- | ||
- component.$$.on_destroy.push(() => { | ||
- componentCache.delete(component) | ||
- }) | ||
}, | ||
unmount: () => { | ||
if (componentCache.has(component)) component.$destroy() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters