-
Couldn't load subscription status.
- Fork 255
Closed
Description
@testing-library/user-eventversion: 13.2.1
- Testing Framework and version: "@testing-library/react": "12.0.0",
- DOM Environment: "@testing-library/jest-dom": "5.14.1",
Relevant code or config
import React from 'react';
import { FormInput } from '@fluentui/react-northstar';
import {render, screen} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
test('type in form input', () => {
render(
<FormInput label="Test" placeholder="welcome" />
);
userEvent.type(screen.getByPlaceholderText('welcome'), 'hello');
expect(screen.getByDisplayValue('hello')).toBeInTheDocument();
});Trying to execute code above fails the test with TypeError: Cannot read property 'document' of null
According to specs the view property of UIEvent should point to the window.
This issue affects other libraries, like microsoft/fluentui#19233.
The more generic fireEvent works fine though - the view property is defined as expected:
act(() => {
fireEvent.change(screen.getByPlaceholderText('welcome'), { target: { value: 'hello' } });
});filipw01
Metadata
Metadata
Assignees
Labels
No labels