- Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
TypeScriptRelated to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.Related to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.bugSomething isn't workingSomething isn't working
Description
@testing-library/reactversion: 12.1.2- Testing Framework and version: jest@27.4.5
- DOM Environment: jsdom
Relevant code or config:
it(`SHOULD open modal window WHEN user click on show button`, () => { const { baseElement } = render(<ControlledModalExample />) expect(screen.queryByTestId(dataTestId)).toBeNull() expect(baseElement.style.getPropertyValue('overflow')).toBe('') fireEvent.click(screen.getByText('Show')) const modal = screen.getByTestId(dataTestId) expect(modal).toBeDefined() expect(baseElement.style.getPropertyValue('overflow')).toBe('hidden') })What you did:
I test the modal component. When a modal has appeared, it should block the body and prevent the user's scroll behavior.
What happened:
After upgrading to @testing-library/react up to 12.1.2 from 11.1.0, I noticed that typing for the baseElement was changed in the 11.12.5.
And I received such error:
Property 'style' does not exist on type 'Element'.
Reproduction:
Try to get some HTML attributes from the baseElement
Problem description:
Previously render returned baseElement as HTMLElement, but now it returns it as Element.
Suggested solution:
Provide examples in the documentation or make flexible types
Metadata
Metadata
Assignees
Labels
TypeScriptRelated to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.Related to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.bugSomething isn't workingSomething isn't working