summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/js/js.js3
-rw-r--r--core/js/tests/specs/coreSpec.js5
-rw-r--r--core/vendor/core.js6
-rw-r--r--core/vendor/snapjs/dist/latest/snap.js6
4 files changed, 17 insertions, 3 deletions
diff --git a/core/js/js.js b/core/js/js.js
index c9427bf533d..a9180663405 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1631,7 +1631,8 @@ function initCore() {
navigationBarSlideGestureAllowed = false;
if (navigationBarSlideGestureEnabled) {
- snapper.disable();
+ var endCurrentDrag = true;
+ snapper.disable(endCurrentDrag);
navigationBarSlideGestureEnabled = false;
navigationBarSlideGestureEnablePending = true;
diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js
index d2bb2a504e9..b6c617303cf 100644
--- a/core/js/tests/specs/coreSpec.js
+++ b/core/js/tests/specs/coreSpec.js
@@ -1175,6 +1175,7 @@ describe('Core base tests', function() {
expect(snapperStub.enable.calledOnce).toBe(true);
expect(snapperStub.disable.calledOnce).toBe(true);
+ expect(snapperStub.disable.alwaysCalledWithExactly(true)).toBe(true);
expect(snapperStub.close.called).toBe(false);
});
it('is not disabled again when disallowing the gesture twice on a narrow screen', function() {
@@ -1190,6 +1191,7 @@ describe('Core base tests', function() {
expect(snapperStub.enable.calledOnce).toBe(true);
expect(snapperStub.disable.calledOnce).toBe(true);
+ expect(snapperStub.disable.alwaysCalledWithExactly(true)).toBe(true);
expect(snapperStub.close.called).toBe(false);
OC.disallowNavigationBarSlideGesture();
@@ -1211,6 +1213,7 @@ describe('Core base tests', function() {
expect(snapperStub.enable.calledOnce).toBe(true);
expect(snapperStub.disable.calledOnce).toBe(true);
+ expect(snapperStub.disable.alwaysCalledWithExactly(true)).toBe(true);
expect(snapperStub.close.called).toBe(false);
OC.allowNavigationBarSlideGesture();
@@ -1232,6 +1235,7 @@ describe('Core base tests', function() {
expect(snapperStub.enable.calledOnce).toBe(true);
expect(snapperStub.disable.calledOnce).toBe(true);
+ expect(snapperStub.disable.alwaysCalledWithExactly(true)).toBe(true);
expect(snapperStub.close.called).toBe(false);
OC.allowNavigationBarSlideGesture();
@@ -1435,6 +1439,7 @@ describe('Core base tests', function() {
expect(snapperStub.enable.calledOnce).toBe(true);
expect(snapperStub.disable.calledTwice).toBe(true);
+ expect(snapperStub.disable.getCall(1).calledWithExactly(true)).toBe(true);
});
it('is disabled when resizing to a wide screen', function() {
viewport.set(480);
diff --git a/core/vendor/core.js b/core/vendor/core.js
index bda270892ad..e573ef10642 100644
--- a/core/vendor/core.js
+++ b/core/vendor/core.js
@@ -6704,9 +6704,13 @@ dav.Client.prototype = {
/**
* Disables Snap.js events
+ * @param {Boolean} endCurrentDrag Whether to end the current drag (if any) or not.
*/
- disable: function() {
+ disable: function(endCurrentDrag) {
utils.dispatchEvent('disable');
+ if (endCurrentDrag) {
+ this.action.drag.endDrag();
+ }
this.action.drag.stopListening();
},
diff --git a/core/vendor/snapjs/dist/latest/snap.js b/core/vendor/snapjs/dist/latest/snap.js
index a0274138de0..7ae088d0aea 100644
--- a/core/vendor/snapjs/dist/latest/snap.js
+++ b/core/vendor/snapjs/dist/latest/snap.js
@@ -744,9 +744,13 @@
/**
* Disables Snap.js events
+ * @param {Boolean} endCurrentDrag Whether to end the current drag (if any) or not.
*/
- disable: function() {
+ disable: function(endCurrentDrag) {
utils.dispatchEvent('disable');
+ if (endCurrentDrag) {
+ this.action.drag.endDrag();
+ }
this.action.drag.stopListening();
},