Improve this Doc  View Source

browserTrigger

  1. - function in module ngMock

Overview

This is a global (window) function that is only available when the ngMock module is included.

It can be used to trigger a native browser event on an element, which is useful for unit testing.

Usage

browserTrigger(element, [eventType], [eventData]);

Arguments

Param Type Details
element Object

Either a wrapped jQuery/jqLite node or a DOMElement

eventType
(optional)
string

Optional event type. If none is specified, the function tries to determine the right event type for the element, e.g. change for input[text].

eventData
(optional)
Object

An optional object which contains additional event data that is used when creating the event: