Skip to content

Commit 930b05a

Browse files
committed
add 'opts' argument to mouseEvent asset
1 parent a2f61b7 commit 930b05a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/jasmine/assets/mouse_event.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
module.exports = function(type, x, y) {
2-
var options = {
1+
module.exports = function(type, x, y, opts) {
2+
var fullOpts = {
33
bubbles: true,
44
clientX: x,
55
clientY: y
66
};
77

8+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
9+
if(opts) {
10+
if(opts.buttons) fullOpts.buttons = opts.buttons;
11+
}
12+
813
var el = document.elementFromPoint(x,y);
9-
var ev = new window.MouseEvent(type, options);
14+
var ev = new window.MouseEvent(type, fullOpts);
1015
el.dispatchEvent(ev);
1116
};

0 commit comments

Comments
 (0)