UserEvent class Null safety UserActions

Test utility methods that provide more advanced simulation of browser interactions than the fireEvent function.

See: testing-library.com/docs/ecosystem-user-event

Annotations

Constructors

UserEvent()

Properties

hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

clear(Element element) → void
Selects the text inside element and deletes it.
click(Element element, {Map eventInit = const {}, bool skipHover = false, int clickCount = 0, bool skipPointerEventsCheck = false}) → void
Clicks element, depending on what element is it can have different side effects.
dblClick(Element element, {Map eventInit = const {}, bool skipPointerEventsCheck = false}) → void
Clicks element twice, depending on what element is it can have different side effects.
deselectOptions(SelectElement selectElement, List values, {Map clickInit = const {}, bool skipPointerEventsCheck = false}) → void
Removes the selection for the specified values of selectElement.
hover(Element element, {Map eventInit = const {}, bool skipPointerEventsCheck = false}) → void
Hovers over element.
keyboard(String text, {KeyboardState? keyboardState, bool autoModify = false, List<Map>? keyboardMap}) KeyboardState
Simulates the keyboard events described by text.
keyboardWithDelay(String text, Duration delay, {KeyboardState? keyboardState, bool autoModify = false, List<Map>? keyboardMap}) Future<KeyboardState>
Simulates the keyboard events described by text with a delay between each keystroke.
paste(Element element, String text, {Map eventInit = const {}, int? initialSelectionStart, int? initialSelectionEnd}) → void
Simulates pasting text into element.
selectOptions(SelectElement selectElement, List values, {Map clickInit = const {}, bool skipPointerEventsCheck = false}) → void
Selects the specified values of selectElement.
tab({bool shift = false, Element? focusTrap}) → void
Fires a tab event changing the document.activeElement in the same way the browser does.
type(Element element, String text, {bool skipClick = false, bool skipAutoClose = false, int? initialSelectionStart, int? initialSelectionEnd}) → void
Writes text inside an input or textarea element.
typeWithDelay(Element element, String text, Duration delay, {bool skipClick = false, bool skipAutoClose = false, dynamic initialSelectionStart, dynamic initialSelectionEnd}) Future<void>
Writes text inside an input or textarea element with a delay between each character typed.
unhover(Element element, {Map eventInit = const {}, bool skipPointerEventsCheck = false}) → void
Unhovers out of element.
upload(Element element, List<File> files, {Map clickInit = const {}, Map changeInit = const {}, bool applyAccept = false}) → void
Uploads files to element.