1
1
import { act , render , screen } from '@testing-library/svelte'
2
- import { VERSION as SVELTE_VERSION } from 'svelte/compiler'
3
- import { describe , expect , test , vi } from 'vitest'
2
+ import { beforeAll , describe , expect , test , vi } from 'vitest'
4
3
5
- import Comp from './fixtures/Comp.svelte'
4
+ import { COMPONENT_FIXTURES , IS_SVELTE_5 , MODE_RUNES } from './utils.js'
5
+
6
+ describe . each ( COMPONENT_FIXTURES ) ( 'rerender ($mode)' , ( { mode, component } ) => {
7
+ let Comp
8
+
9
+ beforeAll ( async ( ) => {
10
+ Comp = await import ( component )
11
+ } )
6
12
7
- describe ( 'rerender' , ( ) => {
8
13
test ( 'updates props' , async ( ) => {
9
14
const { rerender } = render ( Comp , { name : 'World' } )
10
15
const element = screen . getByText ( 'Hello World!' )
@@ -29,13 +34,12 @@ describe('rerender', () => {
29
34
)
30
35
} )
31
36
32
- test ( 'change props with accessors' , async ( ) => {
33
- const { component, getByText } = render (
34
- Comp ,
35
- SVELTE_VERSION < '5'
36
- ? { accessors : true , props : { name : 'World' } }
37
- : { name : 'World' }
38
- )
37
+ test . skipIf ( mode === MODE_RUNES ) ( 'change props with accessors' , async ( ) => {
38
+ const componentOptions = IS_SVELTE_5
39
+ ? { name : 'World' }
40
+ : { accessors : true , props : { name : 'World' } }
41
+
42
+ const { component, getByText } = render ( Comp , componentOptions )
39
43
const element = getByText ( 'Hello World!' )
40
44
41
45
expect ( element ) . toBeInTheDocument ( )
0 commit comments