Skip to content
masterclass Buddy

React Testing Library · Method

userEvent.clear

userEvent.clear removes all content from an editable element. It focuses the element, selects its contents, and deletes them.

Last updated

Syntax

clear(element: Element): Promise<void>

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • userEvent.setup
  • selectOptions
  • deselectOptions
  • type
  • upload

Source: Utility APIs | Testing Library. Checked 2026-11-03.