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

Commit 95400c3

Browse files
committed
fixup!
1 parent f09b7ef commit 95400c3

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

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 protractor / 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: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,37 @@
99
* This is a global (window) function that is only available when the {@link ngMock} module is
1010
* included.
1111
*
12-
* It can be used to trigger a native browser event on an element, which is useful for testing.
12+
* It can be used to trigger a native browser event on an element, which is useful for unit testing.
1313
*
1414
*
1515
* @param {Object} element Either a wrapped jQuery/jqLite node or a DOMElement
1616
* @param {string=} eventType Optional event type. If none is specified, the function tries
1717
* to determine the right event type for the element, e.g. `change` for
1818
* `input[text]`.
19-
* @param {Object=} eventData An optional object which contains additional event data (such as x,y
20-
* coordinates, keys, etc...) that are passed into the event when
21-
* triggered.
19+
* @param {Object=} eventData An optional object which contains additional event data that is used
20+
* when creating the event:
21+
*
22+
* - `keys`: an array of possible modifier keys (ctrl, alt, shift, meta) for the event.
23+
*
24+
* - `x`: x-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
25+
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
26+
*
27+
* - `y`: y-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
28+
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
29+
*
30+
* - `relatedTarget`: the related target for
31+
* [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent).
32+
*
33+
* - `elapsedTime`: the elapsedTime for
34+
* [TransitionEvent](https://developer.mozilla.org/docs/Web/API/TransitionEvent)
35+
* and [AnimationEvent](https://developer.mozilla.org/docs/Web/API/AnimationEvent).
36+
*
37+
* - `bubbles`: [Event.bubbles](https://developer.mozilla.org/docs/Web/API/Event/bubbles).
38+
* Not applicable to all events.
39+
*
40+
* - `cancelable`: [Event.cancelable](https://developer.mozilla.org/docs/Web/API/Event/cancelable).
41+
* Not applicable to all events.
42+
2243
*/
2344
window.browserTrigger = function browserTrigger(element, eventType, eventData) {
2445
if (element && !element.nodeName) element = element[0];
@@ -114,30 +135,11 @@
114135

115136
if (!evnt) return;
116137

117-
var originalPreventDefault = evnt.preventDefault,
118-
appWindow = element.ownerDocument.defaultView,
119-
fakeProcessDefault = true,
120-
finalProcessDefault,
121-
angular = appWindow.angular || {};
122-
123-
// igor: temporary fix for https://bugzilla.mozilla.org/show_bug.cgi?id=684208
124-
angular['ff-684208-preventDefault'] = false;
125-
evnt.preventDefault = function() {
126-
fakeProcessDefault = false;
127-
return originalPreventDefault.apply(evnt, arguments);
128-
};
129-
130138
if (!eventData.bubbles || supportsEventBubblingInDetachedTree() || isAttachedToDocument(element)) {
131-
element.dispatchEvent(evnt);
139+
return element.dispatchEvent(evnt);
132140
} else {
133141
triggerForPath(element, evnt);
134142
}
135-
136-
finalProcessDefault = !(angular['ff-684208-preventDefault'] || !fakeProcessDefault);
137-
138-
delete angular['ff-684208-preventDefault'];
139-
140-
return finalProcessDefault;
141143
};
142144

143145
function supportsTouchEvents() {

0 commit comments

Comments
 (0)