aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngScenario/Scenario.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ngScenario/Scenario.js')
-rw-r--r--src/ngScenario/Scenario.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ngScenario/Scenario.js b/src/ngScenario/Scenario.js
index 4833e629..1f10fc21 100644
--- a/src/ngScenario/Scenario.js
+++ b/src/ngScenario/Scenario.js
@@ -231,8 +231,10 @@ function callerFile(offset) {
* @param {string} type Optional event type.
* @param {Array.<string>=} keys Optional list of pressed keys
* (valid values: 'alt', 'meta', 'shift', 'ctrl')
+ * @param {number} x Optional x-coordinate for mouse/touch events.
+ * @param {number} y Optional y-coordinate for mouse/touch events.
*/
-function browserTrigger(element, type, keys) {
+function browserTrigger(element, type, keys, x, y) {
if (element && !element.nodeName) element = element[0];
if (!element) return;
if (!type) {
@@ -304,7 +306,9 @@ function browserTrigger(element, type, keys) {
return originalPreventDefault.apply(evnt, arguments);
};
- evnt.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, pressed('ctrl'), pressed('alt'),
+ x = x || 0;
+ y = y || 0;
+ evnt.initMouseEvent(type, true, true, window, 0, x, y, x, y, pressed('ctrl'), pressed('alt'),
pressed('shift'), pressed('meta'), 0, element);
element.dispatchEvent(evnt);