1- import { fireEvent as dtlFireEvent , getQueriesForElement , prettyDOM } from '@testing-library/dom'
1+ import {
2+ fireEvent as dtlFireEvent ,
3+ getQueriesForElement ,
4+ prettyDOM ,
5+ } from '@testing-library/dom'
26import { tick } from 'svelte'
37
48const containerCache = new Map ( )
59const componentCache = new Set ( )
610
711const svelteComponentOptions = [
12+ 'accessors' ,
813 'anchor' ,
914 'props' ,
1015 'hydrate' ,
1116 'intro' ,
12- 'context'
17+ 'context' ,
1318]
1419
1520const render = (
@@ -51,13 +56,15 @@ const render = (
5156
5257 let component = new ComponentConstructor ( {
5358 target,
54- ...checkProps ( options )
59+ ...checkProps ( options ) ,
5560 } )
5661
5762 containerCache . set ( container , { target, component } )
5863 componentCache . add ( component )
5964
60- component . $$ . on_destroy . push ( ( ) => { componentCache . delete ( component ) } )
65+ component . $$ . on_destroy . push ( ( ) => {
66+ componentCache . delete ( component )
67+ } )
6168
6269 return {
6370 container,
@@ -69,18 +76,20 @@ const render = (
6976 // eslint-disable-next-line no-new
7077 component = new ComponentConstructor ( {
7178 target,
72- ...checkProps ( options )
79+ ...checkProps ( options ) ,
7380 } )
7481
7582 containerCache . set ( container , { target, component } )
7683 componentCache . add ( component )
7784
78- component . $$ . on_destroy . push ( ( ) => { componentCache . delete ( component ) } )
85+ component . $$ . on_destroy . push ( ( ) => {
86+ componentCache . delete ( component )
87+ } )
7988 } ,
8089 unmount : ( ) => {
8190 if ( componentCache . has ( component ) ) component . $destroy ( )
8291 } ,
83- ...getQueriesForElement ( container , queries )
92+ ...getQueriesForElement ( container , queries ) ,
8493 }
8594}
8695
@@ -89,7 +98,9 @@ const cleanupAtContainer = (container) => {
8998
9099 if ( componentCache . has ( component ) ) component . $destroy ( )
91100
92- if ( target . parentNode === document . body ) { document . body . removeChild ( target ) }
101+ if ( target . parentNode === document . body ) {
102+ document . body . removeChild ( target )
103+ }
93104
94105 containerCache . delete ( container )
95106}
@@ -124,6 +135,4 @@ Object.keys(dtlFireEvent).forEach((key) => {
124135
125136export * from '@testing-library/dom'
126137
127- export {
128- render , cleanup , fireEvent , act
129- }
138+ export { render , cleanup , fireEvent , act }
0 commit comments