@@ -22,27 +22,36 @@ afterwards.
2222``` ts
2323import { beforeEach } from ' vitest'
2424import * as SvelteCore from ' @testing-library/svelte-core'
25+ import type {
26+ Component ,
27+ Exports ,
28+ Rerender ,
29+ } from ' @testing-library/svelte-core/types'
2530
26- import { bindQueries , type Screen } from ' ./bring-your-own-queries.js'
31+ import { bindQueries , type Queries } from ' ./bring-your-own-queries.js'
2732
2833beforeEach (() => {
2934 SvelteCore .cleanup ()
3035})
3136
32- export interface RenderResult <
33- C extends SvelteCore .Component ,
34- > extends SvelteCore .RenderResult <C > {
35- screen: Screen
37+ export interface RenderResult <C extends Component > extends Queries {
38+ container: HTMLElement
39+ component: Exports <C >
40+ rerender: Rerender <C >
41+ unmount: () => void
3642}
3743
3844export const render = <C extends SvelteCore .Component >(
3945 Component : SvelteCore .ComponentImport <C >,
4046 options : SvelteCore .ComponentOptions <C >
4147): RenderResult <C > => {
42- const renderResult = SvelteCore .render (Component , options )
43- const screen = bindQueries (baseElement )
48+ const { component, container, rerender, unmount } = SvelteCore .render (
49+ Component ,
50+ options
51+ )
52+ const queries = bindQueries (baseElement )
4453
45- return { screen , ... renderResult }
54+ return { component , container , rerender , unmount , ... queries }
4655}
4756```
4857
@@ -53,7 +62,7 @@ export const render = <C extends SvelteCore.Component>(
5362Set up the document and mount a component into that document.
5463
5564``` ts
56- const { baseElement, container, component, unmount, rerender } = render (
65+ const { baseElement, container, component, rerender, unmount } = render (
5766 Component ,
5867 componentOptions ,
5968 setupOptions
0 commit comments