Skip to content

Commit 70c2902

Browse files
runspiredarschmitz
authored andcommitted
closes gaps in config and updates tests to match
1 parent da49a27 commit 70c2902

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

src/recognizers/press.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ inherit(PressRecognizer, Recognizer, {
1919
defaults: {
2020
event: 'press',
2121
pointers: 1,
22-
time: 500, // minimal time of the pointer to be pressed
23-
threshold: 5 // a minimal movement is ok, but keep it low
22+
time: 251, // minimal time of the pointer to be pressed
23+
threshold: 9 // a minimal movement is ok, but keep it low
2424
},
2525

2626
getTouchAction: function() {

src/recognizers/swipe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ inherit(SwipeRecognizer, AttrRecognizer, {
1616
defaults: {
1717
event: 'swipe',
1818
threshold: 10,
19-
velocity: 0.65,
19+
velocity: 0.3,
2020
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
2121
pointers: 1
2222
},

src/recognizers/tap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ inherit(TapRecognizer, Recognizer, {
3232
taps: 1,
3333
interval: 300, // max time between the multi-tap taps
3434
time: 250, // max time of the pointer to be down (like finger on the screen)
35-
threshold: 2, // a minimal movement is ok, but keep it low
35+
threshold: 9, // a minimal movement is ok, but keep it low
3636
posThreshold: 10 // a multi-tap can be a bit off the initial position
3737
},
3838

tests/unit/test_gestures.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module('Gesture recognition', {
3737
asyncTest('recognize pan', function() {
3838
expect(1);
3939

40-
Simulator.gestures.pan(el, { deltaX: 100, deltaY: 0 }, function() {
40+
Simulator.gestures.pan(el, { duration: 500, deltaX: 100, deltaY: 0 }, function() {
4141
start();
4242
deepEqual(events, {
4343
pan: true,
@@ -179,22 +179,30 @@ asyncTest('recognize rotate and pinch simultaneous', function() {
179179
asyncTest('don\'t recognize pan and swipe when moving down, when only horizontal is allowed', function() {
180180
expect(1);
181181

182-
Simulator.gestures.swipe(el, { duration: 500, deltaX: 0, deltaZ: 200 }, function() {
182+
Simulator.gestures.swipe(el, { duration: 250, deltaX: 0, deltaZ: 200 }, function() {
183183
start();
184184
deepEqual(events, { });
185185
});
186186
});
187187

188-
asyncTest('don\'t recognize press when a -invalid- tap has been done', function() {
188+
asyncTest('don\'t recognize press if duration is too short.', function() {
189189
expect(1);
190190

191-
Simulator.gestures.press(el, { duration: 500 });
191+
Simulator.gestures.press(el, { duration: 240 });
192+
192193
setTimeout(function() {
193-
Simulator.gestures.tap(el, { duration: 500 });
194-
}, 200);
194+
start();
195+
deepEqual(events, { tap: true }, 'Tap gesture has been recognized.');
196+
}, 275);
197+
});
198+
199+
asyncTest('don\'t recognize tap if duration is too long.', function() {
200+
expect(1);
201+
202+
Simulator.gestures.tap(el, { duration: 255 });
195203

196204
setTimeout(function() {
197205
start();
198-
deepEqual(events, { }, 'no gesture has been recognized. invalid tap and invalid press.');
199-
}, 700);
206+
deepEqual(events, { press: true }, 'Press gesture has been recognized.');
207+
}, 275);
200208
});

0 commit comments

Comments
 (0)