11import { 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'
43
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+ } )
612
7- describe ( 'rerender' , ( ) => {
813 test ( 'updates props' , async ( ) => {
914 const { rerender } = render ( Comp , { name : 'World' } )
1015 const element = screen . getByText ( 'Hello World!' )
@@ -29,13 +34,12 @@ describe('rerender', () => {
2934 )
3035 } )
3136
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 )
3943 const element = getByText ( 'Hello World!' )
4044
4145 expect ( element ) . toBeInTheDocument ( )
0 commit comments