Permalink
Browse files

Test that no tap event is fired on scrolling, closes #574.

  • Loading branch information...
1 parent 7bb2d94 commit 59d3fe59107a9741bc0878048d3199b6dcc21b98 @madrobby committed Jan 25, 2014
Showing with 15 additions and 12 deletions.
  1. +2 −2 test/runner.coffee
  2. +13 −10 test/touch.html
View
@@ -15,7 +15,7 @@ if args.length > 0
suites = args
else
# by default, run all test/*.html pages
- modules = 'zepto ajax callbacks data deferred ajax_deferred detect event form fx selector stack'.split /\s+/
+ modules = 'zepto ajax callbacks data deferred ajax_deferred detect touch event form fx selector stack'.split /\s+/
suites = modules.map (name)-> "test/#{name}.html"
page = require('webpage').create()
@@ -27,7 +27,7 @@ page.onError = (msg, trace) ->
console.log 'ERROR: ' + msg
# used for waiting until the tests finish running
-waitFor = (testFn, onReady, timeout=4000) ->
+waitFor = (testFn, onReady, timeout=30000) ->
start = new Date()
interval = setInterval ->
if testFn()
View
@@ -131,23 +131,27 @@
})
}, 50)
},
-
+
testScrollDoesNotFireTap: function(t){
- var element = $('#test').get(0), fired = false
-
+ var element = $('#test').get(0), count = 0
+
$('#test').on('tap', function () {
- fired = true
+ count++
})
-
+
down(element, 0, 0)
move(element, 0, 20)
move(element, 0, 20)
-
up(element)
-
- t.assertEqual(fired, false)
+
+ t.pause()
+ setTimeout(function(){
+ t.resume(function(){
+ t.assertEqual(0, count)
+ })
+ }, 50)
},
-
+
testSingleTapDoesNotInterfereWithTappingTwice: function(t){
var count = 0, element = $('#test').get(0)
@@ -158,7 +162,6 @@
down(element, 10, 10)
up(element)
-
t.pause()
setTimeout(function(){
down(element, 10, 10)

0 comments on commit 59d3fe5

Please sign in to comment.