Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: Expected behavior for baseElement type
  • Loading branch information
eps1lon committed Mar 4, 2022
commit 17e77a73a40bf98b08f7c14bf0748530eb69a6f2
19 changes: 19 additions & 0 deletions types/test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,25 @@ export function wrappedRenderC(
return pure.render(ui, {wrapper: AppWrapperProps, ...options})
}

export function testBaseElement() {
const {baseElement: baseDefaultElement} = render(<div />)
expectType<HTMLElement, typeof baseDefaultElement>(baseDefaultElement)

const container = document.createElement('input')
const {baseElement: baseElementFromContainer} = render(<div />, {container})
expectType<typeof container, typeof baseElementFromContainer>(
baseElementFromContainer,
)

const baseElementOption = document.createElement('input')
const {baseElement: baseElementFromOption} = render(<div />, {
baseElement: baseElementOption,
})
expectType<typeof baseElementOption, typeof baseElementFromOption>(
baseElementFromOption,
)
}

/*
eslint
testing-library/prefer-explicit-assert: "off",
Expand Down