Skip to main content

Class: FakeMouseEvent

Defined in: packages/dom-core/src/fakeEvents/FakeMouseEvent.ts:5

Fake mouse event for testing.

See

https://github.com/testing-library/react-testing-library/issues/268

Extends

  • MouseEvent

Constructors

Constructor

new FakeMouseEvent(type, overrides): FakeMouseEvent

Defined in: packages/dom-core/src/fakeEvents/FakeMouseEvent.ts:6

Parameters

type

string

overrides

Partial<MouseEvent> = {}

Returns

FakeMouseEvent

Overrides

MouseEvent.constructor

Properties

altKey

readonly altKey: boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16549

MDN Reference

Inherited from

MouseEvent.altKey


AT_TARGET

readonly AT_TARGET: 2

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8765

Inherited from

MouseEvent.AT_TARGET


bubbles

readonly bubbles: boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8660

Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.

MDN Reference

Inherited from

MouseEvent.bubbles


BUBBLING_PHASE

readonly BUBBLING_PHASE: 3

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8766

Inherited from

MouseEvent.BUBBLING_PHASE


button

readonly button: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16551

MDN Reference

Inherited from

MouseEvent.button


buttons

readonly buttons: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16553

MDN Reference

Inherited from

MouseEvent.buttons


cancelable

readonly cancelable: boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8672

Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method.

MDN Reference

Inherited from

MouseEvent.cancelable


cancelBubble

cancelBubble: boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8666

Deprecated

MDN Reference

Inherited from

MouseEvent.cancelBubble


CAPTURING_PHASE

readonly CAPTURING_PHASE: 1

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8764

Inherited from

MouseEvent.CAPTURING_PHASE


clientX

readonly clientX: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16555

MDN Reference

Inherited from

MouseEvent.clientX


clientY

readonly clientY: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16557

MDN Reference

Inherited from

MouseEvent.clientY


composed

readonly composed: boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8678

Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise.

MDN Reference

Inherited from

MouseEvent.composed


ctrlKey

readonly ctrlKey: boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16559

MDN Reference

Inherited from

MouseEvent.ctrlKey


currentTarget

readonly currentTarget: null | EventTarget

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8684

Returns the object whose event listener's callback is currently being invoked.

MDN Reference

Inherited from

MouseEvent.currentTarget


defaultPrevented

readonly defaultPrevented: boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8690

Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.

MDN Reference

Inherited from

MouseEvent.defaultPrevented


detail

readonly detail: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:23812

MDN Reference

Inherited from

MouseEvent.detail


eventPhase

readonly eventPhase: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8696

Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.

MDN Reference

Inherited from

MouseEvent.eventPhase


isTrusted

readonly isTrusted: boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8702

Returns true if event was dispatched by the user agent, and false otherwise.

MDN Reference

Inherited from

MouseEvent.isTrusted


layerX

readonly layerX: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16561

MDN Reference

Inherited from

MouseEvent.layerX


layerY

readonly layerY: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16563

MDN Reference

Inherited from

MouseEvent.layerY


metaKey

readonly metaKey: boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16565

MDN Reference

Inherited from

MouseEvent.metaKey


movementX

readonly movementX: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16567

MDN Reference

Inherited from

MouseEvent.movementX


movementY

readonly movementY: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16569

MDN Reference

Inherited from

MouseEvent.movementY


NONE

readonly NONE: 0

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8763

Inherited from

MouseEvent.NONE


offsetX

readonly offsetX: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16571

MDN Reference

Inherited from

MouseEvent.offsetX


offsetY

readonly offsetY: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16573

MDN Reference

Inherited from

MouseEvent.offsetY


pageX

readonly pageX: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16575

MDN Reference

Inherited from

MouseEvent.pageX


pageY

readonly pageY: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16577

MDN Reference

Inherited from

MouseEvent.pageY


relatedTarget

readonly relatedTarget: null | EventTarget

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16579

MDN Reference

Inherited from

MouseEvent.relatedTarget


returnValue

returnValue: boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8708

Deprecated

MDN Reference

Inherited from

MouseEvent.returnValue


screenX

readonly screenX: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16581

MDN Reference

Inherited from

MouseEvent.screenX


screenY

readonly screenY: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16583

MDN Reference

Inherited from

MouseEvent.screenY


shiftKey

readonly shiftKey: boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16585

MDN Reference

Inherited from

MouseEvent.shiftKey


srcElement

readonly srcElement: null | EventTarget

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8714

Deprecated

MDN Reference

Inherited from

MouseEvent.srcElement


target

readonly target: null | EventTarget

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8720

Returns the object to which event is dispatched (its target).

MDN Reference

Inherited from

MouseEvent.target


timeStamp

readonly timeStamp: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8726

Returns the event's timestamp as the number of milliseconds measured relative to the time origin.

MDN Reference

Inherited from

MouseEvent.timeStamp


type

readonly type: string

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8732

Returns the type of event, e.g. "click", "hashchange", or "submit".

MDN Reference

Inherited from

MouseEvent.type


view

readonly view: null | Window

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:23814

MDN Reference

Inherited from

MouseEvent.view


which

readonly which: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:23820

Deprecated

MDN Reference

Inherited from

MouseEvent.which


x

readonly x: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16587

MDN Reference

Inherited from

MouseEvent.x


y

readonly y: number

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16589

MDN Reference

Inherited from

MouseEvent.y

Methods

composedPath()

Call Signature

composedPath(): EventTarget[]

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8738

Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget.

MDN Reference

Returns

EventTarget[]

Inherited from

MouseEvent.composedPath

Call Signature

composedPath(): EventTarget[]

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.webworker.d.ts:2783

Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget.

MDN Reference

Returns

EventTarget[]

Inherited from

MouseEvent.composedPath


getModifierState()

getModifierState(keyArg): boolean

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16591

MDN Reference

Parameters

keyArg

string

Returns

boolean

Inherited from

MouseEvent.getModifierState


initEvent()

Call Signature

initEvent(type, bubbles?, cancelable?): void

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8744

Parameters
type

string

bubbles?

boolean

cancelable?

boolean

Returns

void

Deprecated

MDN Reference

Inherited from

MouseEvent.initEvent

Call Signature

initEvent(type, bubbles?, cancelable?): void

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.webworker.d.ts:2789

Parameters
type

string

bubbles?

boolean

cancelable?

boolean

Returns

void

Deprecated

MDN Reference

Inherited from

MouseEvent.initEvent


initMouseEvent()

initMouseEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, buttonArg, relatedTargetArg): void

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:16597

Parameters

typeArg

string

canBubbleArg

boolean

cancelableArg

boolean

viewArg

Window

detailArg

number

screenXArg

number

screenYArg

number

clientXArg

number

clientYArg

number

ctrlKeyArg

boolean

altKeyArg

boolean

shiftKeyArg

boolean

metaKeyArg

boolean

buttonArg

number

relatedTargetArg

null | EventTarget

Returns

void

Deprecated

MDN Reference

Inherited from

MouseEvent.initMouseEvent


initUIEvent()

initUIEvent(typeArg, bubblesArg?, cancelableArg?, viewArg?, detailArg?): void

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:23826

Parameters

typeArg

string

bubblesArg?

boolean

cancelableArg?

boolean

viewArg?

null | Window

detailArg?

number

Returns

void

Deprecated

MDN Reference

Inherited from

MouseEvent.initUIEvent


preventDefault()

Call Signature

preventDefault(): void

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8750

If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled.

MDN Reference

Returns

void

Inherited from

MouseEvent.preventDefault

Call Signature

preventDefault(): void

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.webworker.d.ts:2795

If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled.

MDN Reference

Returns

void

Inherited from

MouseEvent.preventDefault


stopImmediatePropagation()

Call Signature

stopImmediatePropagation(): void

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8756

Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.

MDN Reference

Returns

void

Inherited from

MouseEvent.stopImmediatePropagation

Call Signature

stopImmediatePropagation(): void

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.webworker.d.ts:2801

Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.

MDN Reference

Returns

void

Inherited from

MouseEvent.stopImmediatePropagation


stopPropagation()

Call Signature

stopPropagation(): void

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts:8762

When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.

MDN Reference

Returns

void

Inherited from

MouseEvent.stopPropagation

Call Signature

stopPropagation(): void

Defined in: node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.webworker.d.ts:2807

When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.

MDN Reference

Returns

void

Inherited from

MouseEvent.stopPropagation