@@ -3,6 +3,12 @@ describe('Ionic Tap', function() {
3
3
beforeEach ( function ( ) {
4
4
window . console . debug = function ( ) { } ;
5
5
ionic . tap . reset ( ) ;
6
+ window . _setTimeout = window . setTimeout ;
7
+ window . setTimeout = function ( ) { } ;
8
+ } ) ;
9
+
10
+ afterEach ( function ( ) {
11
+ window . setTimeout = window . _setTimeout ;
6
12
} ) ;
7
13
8
14
it ( 'Should focus on an input if it hasnt scrolled' , function ( ) {
@@ -240,4 +246,48 @@ describe('Ionic Tap', function() {
240
246
expect ( ele . hasSecondFocus ) . toBeUndefined ( ) ;
241
247
} ) ;
242
248
249
+ it ( 'Should recordCoordinates and isRecentTap' , function ( ) {
250
+ var e = {
251
+ clientX : 100 ,
252
+ clientY : 100
253
+ } ;
254
+ expect ( ionic . tap . isRecentTap ( e ) ) . toBeUndefined ( ) ;
255
+ ionic . tap . recordCoordinates ( e ) ;
256
+ expect ( ionic . tap . isRecentTap ( e ) ) . toBeDefined ( ) ;
257
+ } ) ;
258
+
259
+ it ( 'Should ignoreTapInspect because of isRecentTap' , function ( ) {
260
+ var e = {
261
+ type : 'touchend' ,
262
+ clientX : 100 ,
263
+ clientY : 100
264
+ } ;
265
+ ionic . tap . recordCoordinates ( e ) ;
266
+ expect ( ionic . tap . ignoreTapInspect ( e ) ) . toEqual ( true ) ;
267
+ } ) ;
268
+
269
+ it ( 'Should ignoreTapInspect because of hasTouchScrolled' , function ( ) {
270
+ ionic . tap . setTouchStart ( { clientX : 100 , clientY : 100 } ) ;
271
+ var e = {
272
+ type : 'touchend' ,
273
+ clientX : 200 ,
274
+ clientY : 200
275
+ } ;
276
+ expect ( ionic . tap . ignoreTapInspect ( e ) ) . toEqual ( true ) ;
277
+ } ) ;
278
+
279
+ it ( 'Should ignoreTapInspect because of touchcancel event' , function ( ) {
280
+ var e = {
281
+ type : 'touchcancel'
282
+ } ;
283
+ expect ( ionic . tap . ignoreTapInspect ( e ) ) . toEqual ( true ) ;
284
+ } ) ;
285
+
286
+ it ( 'Should not ignoreTapInspect' , function ( ) {
287
+ var e = {
288
+ type : 'touchend'
289
+ } ;
290
+ expect ( ionic . tap . ignoreTapInspect ( e ) ) . toEqual ( false ) ;
291
+ } ) ;
292
+
243
293
} ) ;
0 commit comments