Permalink
Browse files

closes gaps in config and updates tests to match

  • Loading branch information...
runspired authored and arschmitz committed Oct 26, 2015
1 parent da49a27 commit 70c2902d773a750e92ce8c423f8a4165c07eab97
Showing with 20 additions and 12 deletions.
  1. +2 −2 src/recognizers/press.js
  2. +1 −1 src/recognizers/swipe.js
  3. +1 −1 src/recognizers/tap.js
  4. +16 −8 tests/unit/test_gestures.js
View
@@ -19,8 +19,8 @@ inherit(PressRecognizer, Recognizer, {
defaults: {
event: 'press',
pointers: 1,
- time: 500, // minimal time of the pointer to be pressed
- threshold: 5 // a minimal movement is ok, but keep it low
+ time: 251, // minimal time of the pointer to be pressed
+ threshold: 9 // a minimal movement is ok, but keep it low
},
getTouchAction: function() {
View
@@ -16,7 +16,7 @@ inherit(SwipeRecognizer, AttrRecognizer, {
defaults: {
event: 'swipe',
threshold: 10,
- velocity: 0.65,
+ velocity: 0.3,
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
pointers: 1
},
View
@@ -32,7 +32,7 @@ inherit(TapRecognizer, Recognizer, {
taps: 1,
interval: 300, // max time between the multi-tap taps
time: 250, // max time of the pointer to be down (like finger on the screen)
- threshold: 2, // a minimal movement is ok, but keep it low
+ threshold: 9, // a minimal movement is ok, but keep it low
posThreshold: 10 // a multi-tap can be a bit off the initial position
},
@@ -37,7 +37,7 @@ module('Gesture recognition', {
asyncTest('recognize pan', function() {
expect(1);
- Simulator.gestures.pan(el, { deltaX: 100, deltaY: 0 }, function() {
+ Simulator.gestures.pan(el, { duration: 500, deltaX: 100, deltaY: 0 }, function() {
start();
deepEqual(events, {
pan: true,
@@ -179,22 +179,30 @@ asyncTest('recognize rotate and pinch simultaneous', function() {
asyncTest('don\'t recognize pan and swipe when moving down, when only horizontal is allowed', function() {
expect(1);
- Simulator.gestures.swipe(el, { duration: 500, deltaX: 0, deltaZ: 200 }, function() {
+ Simulator.gestures.swipe(el, { duration: 250, deltaX: 0, deltaZ: 200 }, function() {
start();
deepEqual(events, { });
});
});
-asyncTest('don\'t recognize press when a -invalid- tap has been done', function() {
+asyncTest('don\'t recognize press if duration is too short.', function() {
expect(1);
- Simulator.gestures.press(el, { duration: 500 });
+ Simulator.gestures.press(el, { duration: 240 });
+
setTimeout(function() {
- Simulator.gestures.tap(el, { duration: 500 });
- }, 200);
+ start();
+ deepEqual(events, { tap: true }, 'Tap gesture has been recognized.');
+ }, 275);
+});
+
+asyncTest('don\'t recognize tap if duration is too long.', function() {
+ expect(1);
+
+ Simulator.gestures.tap(el, { duration: 255 });
setTimeout(function() {
start();
- deepEqual(events, { }, 'no gesture has been recognized. invalid tap and invalid press.');
- }, 700);
+ deepEqual(events, { press: true }, 'Press gesture has been recognized.');
+ }, 275);
});

0 comments on commit 70c2902

Please sign in to comment.