From 3769af532b62dad2079e0a68fea89dffd206f704 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Thu, 13 Aug 2020 19:56:22 -0700 Subject: [PATCH] Fixed tests to account for #1459 fix (fire drag-end event even if pointer didn't move) --- src/openseadragon.js | 2 +- test/helpers/legacy.mouse.shim.js | 11 ++++++++++- test/modules/events.js | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index 9366c896..97602289 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -2048,7 +2048,7 @@ function OpenSeadragon( options ){ }, /** - * COnvert passed addEventListener() options to boolean or options object, + * Convert passed addEventListener() options to boolean or options object, * depending on browser support. * @function * @param {Boolean|Object} [options] Boolean useCapture, or if [supportsEventListenerOptions]{@link OpenSeadragon.supportsEventListenerOptions}, can be an object diff --git a/test/helpers/legacy.mouse.shim.js b/test/helpers/legacy.mouse.shim.js index 3a318a1f..e4740138 100644 --- a/test/helpers/legacy.mouse.shim.js +++ b/test/helpers/legacy.mouse.shim.js @@ -12,6 +12,7 @@ } $.MouseTracker.havePointerEvents = false; + $.MouseTracker.unprefixedPointerEvents = true; $.MouseTracker.subscribeEvents.push( "mouseenter", "mouseleave" ); if ( $.Browser.vendor !== $.BROWSERS.IE || $.Browser.version > 8 ) { $.MouseTracker.subscribeEvents.push( "mouseover", "mouseout" ); @@ -20,6 +21,15 @@ $.MouseTracker.havePointerOverOut = false; } $.MouseTracker.subscribeEvents.push( "mousedown", "mouseup", "mousemove" ); + $.MouseTracker.mousePointerId = "legacy-mouse"; + // Legacy mouse events capture support (IE/Firefox only?) + $.MouseTracker.havePointerCapture = (function () { + var divElement = document.createElement( 'div' ); + return $.isFunction( divElement.setCapture ) && $.isFunction( divElement.releaseCapture ); + }()); + if ( $.MouseTracker.havePointerCapture ) { + $.MouseTracker.subscribeEvents.push( "losecapture" ); + } if ( 'ontouchstart' in window ) { // iOS, Android, and other W3c Touch Event implementations // (see http://www.w3.org/TR/touch-events/) @@ -32,6 +42,5 @@ // Subscribe to these to prevent default gesture handling $.MouseTracker.subscribeEvents.push( "gesturestart", "gesturechange" ); } - $.MouseTracker.mousePointerId = "legacy-mouse"; }(OpenSeadragon)); diff --git a/test/modules/events.js b/test/modules/events.js index 68e6232d..d07a3eea 100644 --- a/test/modules/events.js +++ b/test/modules/events.js @@ -452,7 +452,7 @@ clickCount: 2, dblClickCount: 1, dragCount: 0, - dragEndCount: 0, + dragEndCount: 2, // v2.5.0+ drag-end event now fired even if pointer didn't move (#1459) insideElementPressed: true, insideElementReleased: true, contacts: 0, @@ -480,7 +480,7 @@ clickCount: 1, dblClickCount: 0, dragCount: 0, - dragEndCount: 0, + dragEndCount: 1, // v2.5.0+ drag-end event now fired even if pointer didn't move (#1459) insideElementPressed: true, insideElementReleased: true, contacts: 0,