Skip to content

Commit d2a7b51

Browse files
committed
docs(*): add browserTrigger docs; update references to scenario runner
1 parent 2ecd85b commit d2a7b51

File tree

3 files changed

+49
-7
lines changed

3 files changed

+49
-7
lines changed

docs/content/guide/e2e-testing.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div class="alert alert-danger">
99
**Note:** In the past, end-to-end testing could be done with a deprecated tool called
1010
[Angular Scenario Runner](http://code.angularjs.org/1.2.16/docs/guide/e2e-testing). That tool
11-
is now in maintenance mode.
11+
is now in maintenance mode, and will be removed in version 1.7.0.
1212
</div>
1313

1414
As applications grow in size and complexity, it becomes unrealistic to rely on manual testing to

src/ng/browser.js

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ function Browser(window, document, $log, $sniffer) {
6767

6868
/**
6969
* @private
70-
* Note: this method is used only by scenario runner
7170
* TODO(vojta): prefix this method with $$ ?
7271
* @param {function()} callback Function that will be called when no outstanding request
7372
*/

src/ngMock/browserTrigger.js

+48-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,56 @@
22

33
(function() {
44
/**
5-
* Triggers a browser event. Attempts to choose the right event if one is
6-
* not specified.
5+
* @ngdoc function
6+
* @name browserTrigger
7+
* @description
8+
*
9+
* This is a global (window) function that is only available when the {@link ngMock} module is
10+
* included.
11+
*
12+
* It can be used to trigger a native browser event on an element, which is useful for unit testing.
13+
*
714
*
815
* @param {Object} element Either a wrapped jQuery/jqLite node or a DOMElement
9-
* @param {string} eventType Optional event type
10-
* @param {Object=} eventData An optional object which contains additional event data (such as x,y
11-
* coordinates, keys, etc...) that are passed into the event when triggered
16+
* @param {string=} eventType Optional event type. If none is specified, the function tries
17+
* to determine the right event type for the element, e.g. `change` for
18+
* `input[text]`.
19+
* @param {Object=} eventData An optional object which contains additional event data that is used
20+
* when creating the event:
21+
*
22+
* - `bubbles`: [Event.bubbles](https://developer.mozilla.org/docs/Web/API/Event/bubbles).
23+
* Not applicable to all events.
24+
*
25+
* - `cancelable`: [Event.cancelable](https://developer.mozilla.org/docs/Web/API/Event/cancelable).
26+
* Not applicable to all events.
27+
*
28+
* - `charcode`: [charCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/charcode)
29+
* for keyboard events (keydown, keypress, and keyup).
30+
*
31+
* - `elapsedTime`: the elapsedTime for
32+
* [TransitionEvent](https://developer.mozilla.org/docs/Web/API/TransitionEvent)
33+
* and [AnimationEvent](https://developer.mozilla.org/docs/Web/API/AnimationEvent).
34+
*
35+
* - `keycode`: [keyCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/keycode)
36+
* for keyboard events (keydown, keypress, and keyup).
37+
*
38+
* - `keys`: an array of possible modifier keys (ctrl, alt, shift, meta) for
39+
* [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) and
40+
* keyboard events (keydown, keypress, and keyup).
41+
*
42+
* - `relatedTarget`: the
43+
* [relatedTarget](https://developer.mozilla.org/docs/Web/API/MouseEvent/relatedTarget)
44+
* for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent).
45+
*
46+
* - `which`: [which](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/which)
47+
* for keyboard events (keydown, keypress, and keyup).
48+
*
49+
* - `x`: x-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
50+
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
51+
*
52+
* - `y`: y-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
53+
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
54+
*
1255
*/
1356
window.browserTrigger = function browserTrigger(element, eventType, eventData) {
1457
if (element && !element.nodeName) element = element[0];

0 commit comments

Comments
 (0)