Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 167766a

Browse files
committed
docs(*): add browserTrigger docs; remove references to scenario runner
1 parent 0cd3921 commit 167766a

File tree

3 files changed

+48
-12
lines changed

3 files changed

+48
-12
lines changed

docs/content/guide/e2e-testing.ngdoc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55

66
# E2E Testing
77

8-
<div class="alert alert-danger">
9-
**Note:** In the past, end-to-end testing could be done with a deprecated tool called
10-
[AngularJS Scenario Runner](http://code.angularjs.org/1.2.16/docs/guide/e2e-testing). That tool
11-
is now in maintenance mode.
12-
</div>
13-
148
As applications grow in size and complexity, it becomes unrealistic to rely on manual testing to
159
verify the correctness of new features, catch bugs and notice regressions. Unit tests
1610
are the first line of defense for catching bugs, but sometimes issues come up with integration

src/ng/browser.js

Lines changed: 0 additions & 1 deletion
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

Lines changed: 48 additions & 5 deletions
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)