• Version 14.4.3
  • Published
  • 420 kB
  • No dependencies
  • MIT license


npm i @testing-library/user-event
yarn add @testing-library/user-event
pnpm add @testing-library/user-event


Fire events the same way the user does



variable userEvent

const userEvent: {
readonly setup: typeof setupMain;
readonly clear: typeof directApi.clear;
readonly click: typeof directApi.click;
readonly copy: typeof directApi.copy;
readonly cut: typeof directApi.cut;
readonly dblClick: typeof directApi.dblClick;
readonly deselectOptions: typeof directApi.deselectOptions;
readonly hover: typeof directApi.hover;
readonly keyboard: typeof directApi.keyboard;
readonly pointer: typeof directApi.pointer;
readonly paste: typeof directApi.paste;
readonly selectOptions: typeof directApi.selectOptions;
readonly tripleClick: typeof directApi.tripleClick;
readonly type: typeof directApi.type;
readonly unhover: typeof directApi.unhover;
readonly upload: typeof directApi.upload;
readonly tab: typeof directApi.tab;


    interface keyboardKey

    interface keyboardKey {}

      property altGr

      altGr?: boolean;
      • Does the character in key require/imply AltRight to be pressed?

      property code

      code?: string;
      • Physical location on a keyboard

      property key

      key?: string;
      • Character or functional key descriptor

      property location

      location?: DOM_KEY_LOCATION;
      • Location on the keyboard for keys with multiple representation

      property shift

      shift?: boolean;
      • Does the character in key require/imply a shiftKey to be pressed?

      interface pointerKey

      interface pointerKey {}

        property button

        button?: MouseButton;
        • Type of button

        property name

        name: string;
        • Name of the pointer key

        property pointerType

        pointerType: 'mouse' | 'pen' | 'touch';
        • Type of the pointer device


        enum PointerEventsCheckLevel

        enum PointerEventsCheckLevel {
        EachTrigger = 4,
        EachApiCall = 2,
        EachTarget = 1,
        Never = 0,

          member EachApiCall

          EachApiCall = 2
          • Check each target once per call to pointer (related) API

          member EachTarget

          EachTarget = 1
          • Check each event target once

          member EachTrigger

          EachTrigger = 4
          • Check pointer events on every user interaction that triggers a bunch of events. E.g. once for releasing a mouse button even though this triggers pointerup, mouseup, click, etc...

          member Never

          Never = 0
          • No pointer events check

          Package Files (5)

          Dependencies (0)

          No dependencies.

          Dev Dependencies (20)

          Peer Dependencies (1)


          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@testing-library/user-event.

          • Markdown
          • HTML
            <a href="https://www.jsdocs.io/package/@testing-library/user-event"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>