22// Project: https://github.com/testing-library/svelte-testing-library
33// Definitions by: Rahim Alwer <https://github.com/mihar-22>
44
5- import { BoundFunction , EventType , Queries , queries } from '@testing-library/dom'
6- import { ComponentConstructorOptions , ComponentProps , SvelteComponent } from 'svelte'
5+ import {
6+ BoundFunction ,
7+ EventType ,
8+ Queries ,
9+ queries ,
10+ } from '@testing-library/dom'
11+ import {
12+ ComponentConstructorOptions ,
13+ ComponentProps ,
14+ SvelteComponent ,
15+ } from 'svelte'
716
817export * from '@testing-library/dom'
918
10- type SvelteComponentOptions < C extends SvelteComponent > = ComponentProps < C > | Pick < ComponentConstructorOptions < ComponentProps < C > > , "anchor" | "props" | "hydrate" | "intro" | "context" >
19+ type SvelteComponentOptions < C extends SvelteComponent > =
20+ | ComponentProps < C >
21+ | Pick <
22+ ComponentConstructorOptions < ComponentProps < C > > ,
23+ 'anchor' | 'props' | 'hydrate' | 'intro' | 'context'
24+ >
1125
1226type Omit < T , K extends keyof T > = Pick < T , Exclude < keyof T , K > >
1327
14- type Constructor < T > = new ( ...args : any [ ] ) => T ;
28+ type Constructor < T > = new ( ...args : any [ ] ) => T
1529
1630/**
1731 * Render a Component into the Document.
1832 */
19- export type RenderResult < C extends SvelteComponent , Q extends Queries = typeof queries > = {
33+ export type RenderResult <
34+ C extends SvelteComponent ,
35+ Q extends Queries = typeof queries ,
36+ > = {
2037 container : HTMLElement
2138 component : C
2239 debug : ( el ?: HTMLElement | DocumentFragment ) => void
23- rerender : ( options : SvelteComponentOptions < C > ) => void
40+ rerender : ( props : ComponentProps < C > ) => Promise < void >
2441 unmount : ( ) => void
2542} & { [ P in keyof Q ] : BoundFunction < Q [ P ] > }
2643
@@ -38,7 +55,7 @@ export function render<C extends SvelteComponent>(
3855export function render < C extends SvelteComponent , Q extends Queries > (
3956 component : Constructor < C > ,
4057 componentOptions ?: SvelteComponentOptions < C > ,
41- renderOptions ?: RenderOptions < Q > ,
58+ renderOptions ?: RenderOptions < Q >
4259) : RenderResult < C , Q >
4360
4461/**
@@ -50,13 +67,19 @@ export function cleanup(): void
5067 * Fires DOM events on an element provided by @testing-library/dom. Since Svelte needs to flush
5168 * pending state changes via `tick`, these methods have been override and now return a promise.
5269 */
53- export type FireFunction = ( element : Document | Element | Window , event : Event ) => Promise < boolean > ;
70+ export type FireFunction = (
71+ element : Document | Element | Window ,
72+ event : Event
73+ ) => Promise < boolean >
5474
5575export type FireObject = {
56- [ K in EventType ] : ( element : Document | Element | Window , options ?: { } ) => Promise < boolean > ;
57- } ;
76+ [ K in EventType ] : (
77+ element : Document | Element | Window ,
78+ options ?: { }
79+ ) => Promise < boolean >
80+ }
5881
59- export const fireEvent : FireFunction & FireObject ;
82+ export const fireEvent : FireFunction & FireObject
6083
6184/**
6285 * Calls a function and notifies Svelte to flush any pending state changes.
0 commit comments