@@ -176,31 +176,55 @@ describe('Ionic Tap', function() {
176
176
expect ( c ) . toEqual ( { x :0 , y : 0 } ) ;
177
177
} ) ;
178
178
179
- it ( 'Should not fire a tap for disabled elements' , function ( ) {
179
+ it ( 'Should ignoreSimulateClick for disabled elements' , function ( ) {
180
180
// Disabled elements should not be tapped
181
181
var targetEle = document . createElement ( 'input' ) ;
182
182
targetEle . disabled = true ;
183
- var event = { } ;
184
- ionic . tap . simulateClick ( targetEle , event ) ;
185
- expect ( event . tapIgnored ) . toEqual ( true ) ;
183
+ expect ( ionic . tap . ignoreSimulateClick ( targetEle ) ) . toEqual ( true ) ;
186
184
} ) ;
187
185
188
- it ( 'Should not fire a tap for input[file] elements' , function ( ) {
186
+ it ( 'Should ignoreSimulateClick for input[file] elements' , function ( ) {
189
187
// Reported that on Android input[file] does not open using the tap
190
188
var targetEle = document . createElement ( 'input' ) ;
191
189
targetEle . type = 'file' ;
192
- var event = { } ;
193
- ionic . tap . simulateClick ( targetEle , event ) ;
194
- expect ( event . tapIgnored ) . toEqual ( true ) ;
190
+ expect ( ionic . tap . ignoreSimulateClick ( targetEle ) ) . toEqual ( true ) ;
195
191
} ) ;
196
192
197
- it ( 'Should not fire a tap for input[range] elements' , function ( ) {
193
+ it ( 'Should ignoreSimulateClick for input[range] elements' , function ( ) {
198
194
// Range and tap do not agree, probably because it doesn't have a delay to begin with
199
195
var targetEle = document . createElement ( 'input' ) ;
200
196
targetEle . type = 'range' ;
201
- var event = { } ;
202
- ionic . tap . simulateClick ( targetEle , event ) ;
203
- expect ( event . tapIgnored ) . toEqual ( true ) ;
197
+ expect ( ionic . tap . ignoreSimulateClick ( targetEle ) ) . toEqual ( true ) ;
198
+ } ) ;
199
+
200
+ it ( 'Should not ignoreSimulateClick for common inputs' , function ( ) {
201
+ var inputTypes = [ 'text' , 'email' , 'search' , 'tel' , 'number' , 'date' , 'month' , 'password' , null , undefined , '' ] ;
202
+ for ( var x = 0 ; x < inputTypes . length ; x ++ ) {
203
+ var targetEle = document . createElement ( 'input' ) ;
204
+ targetEle . type = inputTypes [ x ] ;
205
+ expect ( ionic . tap . ignoreSimulateClick ( targetEle ) ) . toEqual ( false ) ;
206
+ }
207
+ expect ( ionic . tap . ignoreSimulateClick ( document . createElement ( 'div' ) ) ) . toEqual ( false ) ;
208
+ expect ( ionic . tap . ignoreSimulateClick ( document . createElement ( 'textarea' ) ) ) . toEqual ( false ) ;
209
+ expect ( ionic . tap . ignoreSimulateClick ( document . createElement ( 'select' ) ) ) . toEqual ( false ) ;
210
+ } ) ;
211
+
212
+ it ( 'Should correctly check for tap elements' , function ( ) {
213
+ expect ( ionic . tap . isTapElement ( 'A' ) ) . toEqual ( true ) ;
214
+ expect ( ionic . tap . isTapElement ( 'INPUT' ) ) . toEqual ( true ) ;
215
+ expect ( ionic . tap . isTapElement ( 'BUTTON' ) ) . toEqual ( true ) ;
216
+ expect ( ionic . tap . isTapElement ( 'LABEL' ) ) . toEqual ( true ) ;
217
+ expect ( ionic . tap . isTapElement ( 'TEXTAREA' ) ) . toEqual ( true ) ;
218
+ expect ( ionic . tap . isTapElement ( 'SELECT' ) ) . toEqual ( true ) ;
219
+
220
+ expect ( ionic . tap . isTapElement ( 'DIV' ) ) . toEqual ( false ) ;
221
+ expect ( ionic . tap . isTapElement ( 'SPAN' ) ) . toEqual ( false ) ;
222
+ expect ( ionic . tap . isTapElement ( 'I' ) ) . toEqual ( false ) ;
223
+ expect ( ionic . tap . isTapElement ( 'BODY' ) ) . toEqual ( false ) ;
224
+ expect ( ionic . tap . isTapElement ( 'SECTION' ) ) . toEqual ( false ) ;
225
+ expect ( ionic . tap . isTapElement ( 'ASIDE' ) ) . toEqual ( false ) ;
226
+ expect ( ionic . tap . isTapElement ( 'LI' ) ) . toEqual ( false ) ;
227
+ expect ( ionic . tap . isTapElement ( 'P' ) ) . toEqual ( false ) ;
204
228
} ) ;
205
229
206
230
} ) ;
0 commit comments