Skip to content

Commit b9836da

Browse files
committed
Clarify difference between rendered element and container
1 parent d918b3f commit b9836da

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

types/test.tsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {render, fireEvent, screen, waitFor} from '.'
33
import * as pure from './pure'
44

55
export async function testRender() {
6-
const page = render(<div />)
6+
const page = render(<button />)
77

88
// single queries
99
page.getByText('foo')
@@ -22,7 +22,7 @@ export async function testRender() {
2222
}
2323

2424
export async function testPureRender() {
25-
const page = pure.render(<div />)
25+
const page = pure.render(<button />)
2626

2727
// single queries
2828
page.getByText('foo')
@@ -43,8 +43,9 @@ export async function testPureRender() {
4343
export function testRenderOptions() {
4444
const container = document.createElement('div')
4545
const options = {container}
46-
const {container: returnedContainer} = render(<div />, options)
47-
// Unclear why TypeScript infers `HTMLElement` here when the the input `container` is `HTMLDivElement`
46+
const {container: returnedContainer} = render(<button />, options)
47+
// Unclear why TypeScript infers `HTMLElement` here when the the input `container` is `HTMLDivElement`.
48+
// It's working for `testSVGRenderOptions`.
4849
// Hopefully this breaks someday and we can switch to
4950
// expectType<HTMLDivElement, typeof returnedContainer>(returnedContainer)
5051
expectType<HTMLElement, typeof returnedContainer>(returnedContainer)
@@ -56,7 +57,7 @@ export function testSVGRenderOptions() {
5657
'svg',
5758
)
5859
const options = {container}
59-
const {container: returnedContainer} = render(<svg />, options)
60+
const {container: returnedContainer} = render(<path />, options)
6061
expectType<SVGSVGElement, typeof returnedContainer>(returnedContainer)
6162
}
6263

0 commit comments

Comments
 (0)