3 var DoubleTapper = require('./double-tapper');
4 var assert = require('assert');
6 describe('double-tapper', function() {
7 it('recognises a single click', function() {
8 var doubleTapper = new DoubleTapper();
10 var count = doubleTapper.registerTap();
12 assert.equal(count, 1);
15 it('recognises an instant double click', function() {
16 var doubleTapper = new DoubleTapper();
18 doubleTapper.registerTap();
19 var count = doubleTapper.registerTap();
21 assert.equal(count, 2);
24 it('recognises a slow double click', function(done) {
25 var doubleTapper = new DoubleTapper();
27 doubleTapper.registerTap();
28 setTimeout(function() {
29 var count = doubleTapper.registerTap();
31 assert.equal(count, 2);
36 it('recognises a two single clicks', function(done) {
37 var doubleTapper = new DoubleTapper();
39 doubleTapper.registerTap();
40 setTimeout(function() {
41 var count = doubleTapper.registerTap();
43 assert.equal(count, 1);
48 it('recognises a triple click', function(done) {
49 var doubleTapper = new DoubleTapper();
51 doubleTapper.registerTap();
52 setTimeout(function() {
53 doubleTapper.registerTap();
55 setTimeout(function() {
56 var count = doubleTapper.registerTap();
58 assert.equal(count, 3);