Skip to content

Commit 17e77a7

Browse files
committed
test: Expected behavior for baseElement type
1 parent b0f9d97 commit 17e77a7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

types/test.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,25 @@ export function wrappedRenderC(
141141
return pure.render(ui, {wrapper: AppWrapperProps, ...options})
142142
}
143143

144+
export function testBaseElement() {
145+
const {baseElement: baseDefaultElement} = render(<div />)
146+
expectType<HTMLElement, typeof baseDefaultElement>(baseDefaultElement)
147+
148+
const container = document.createElement('input')
149+
const {baseElement: baseElementFromContainer} = render(<div />, {container})
150+
expectType<typeof container, typeof baseElementFromContainer>(
151+
baseElementFromContainer,
152+
)
153+
154+
const baseElementOption = document.createElement('input')
155+
const {baseElement: baseElementFromOption} = render(<div />, {
156+
baseElement: baseElementOption,
157+
})
158+
expectType<typeof baseElementOption, typeof baseElementFromOption>(
159+
baseElementFromOption,
160+
)
161+
}
162+
144163
/*
145164
eslint
146165
testing-library/prefer-explicit-assert: "off",

0 commit comments

Comments
 (0)