Skip to content

onClickEvent

Listens for clicks on the element. The mock registers a plain click listener, which cannot be removed.

Import:

import 'obsidian-test-mocks/setup';

Signature:

function onClickEvent(this: HTMLElement, listener: (this: HTMLElement, event: MouseEvent) => unknown, options: boolean | AddEventListenerOptions | undefined): void

Parameters:

Parameter Type Description
this HTMLElement
listener (this: HTMLElement, event: MouseEvent) => unknown The listener to call with each click, with the element as this.
options boolean | AddEventListenerOptions | undefined Standard addEventListener options.

Returns: void