aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/event.js
diff options
context:
space:
mode:
authorAditya Raghavan <araghavan3@gmail.com>2014-12-20 18:41:24 -0500
committerDave Methvin <dave.methvin@gmail.com>2015-01-05 15:30:32 -0500
commit5b0b1b77dbc41c144959ef2fe8de603555beb39b (patch)
tree1fc5f80fbba9a9eed2fb3c1ee5d78d6c58a5a094 /test/unit/event.js
parenta0bf5bf710e98f86a49fc0c293232250f6c40ee1 (diff)
downloadjquery-5b0b1b77dbc41c144959ef2fe8de603555beb39b.tar.gz
jquery-5b0b1b77dbc41c144959ef2fe8de603555beb39b.zip
Event: Normalize mouse event properties in drag events
DragEvent is a superset of MouseEvent, so we want to fix up mouse properties like pageX and pageY. Fixes gh-1925 (cherry picked from commit 389b2ab3b93bfd68ca6c6153a43e11d93ab9ec71)
Diffstat (limited to 'test/unit/event.js')
-rw-r--r--test/unit/event.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/event.js b/test/unit/event.js
index c772ef44c..8992a0b95 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -2477,6 +2477,25 @@ test("fixHooks extensions", function() {
jQuery.event.fixHooks.click = saved;
});
+// IE8 doesn't support custom event triggering natively, but we can skip
+// this test in IE8 since a native HTML5 drag event will never occur there.
+if ( document.createEvent ) {
+
+ test( "drag events copy over mouse related event properties (gh-1925)", function() {
+ expect( 2 );
+
+ var $fixture = jQuery( "<div id='drag-fixture'></div>" ).appendTo( "body" );
+
+ $fixture.on( "dragmove", function( evt ) {
+ ok( "pageX" in evt, "checking for pageX property" );
+ ok( "pageY" in evt, "checking for pageY property" );
+ });
+
+ fireNative( $fixture[ 0 ], "dragmove" );
+ $fixture.unbind( "dragmove" ).remove();
+ });
+}
+
test( "focusin using non-element targets", function() {
expect( 2 );