File tree 1 file changed +18
-10
lines changed
1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change 360
360
361
361
action ( elem ) ;
362
362
363
- // WebKit and IE9 standards mode fire change events when the
364
- // checkbox isn't toggled.
365
- assertChanges (
366
- goog . userAgent . WEBKIT || bot . userAgent . IE_DOC_9 ? 1 : 0 ) ;
363
+ // Some browsers fire change events when the checkbox isn't toggled.
364
+ assertChanges ( firesChangeEventIfNotToggled ( ) ? 1 : 0 ) ;
367
365
assertFalse ( bot . dom . isSelected ( elem ) ) ;
368
366
}
369
367
368
+ function firesChangeEventIfNotToggled ( ) {
369
+ if ( goog . userAgent . product . CHROME && bot . userAgent . isProductVersion ( 45 ) ) {
370
+ // Chrome 45 and above do not fire the change event.
371
+ return false ;
372
+ } else if ( goog . userAgent . WEBKIT || bot . userAgent . IE_DOC_9 ) {
373
+ // Other browsers with goog.userAgent.WEBKIT fire the change event.
374
+ // IE 9 standards mode fires the change event.
375
+ return true ;
376
+ }
377
+
378
+ // All other browsers do not fire the change event.
379
+ return false ;
380
+ }
381
+
370
382
var testClickCannotSelectCheckboxWhenDefaultPrevented =
371
383
goog . partial ( cannotSelectCheckboxWhenDefaultPrevented ,
372
384
bot . action . click ) ;
394
406
assertChanges ( 1 ) ;
395
407
assertTrue ( bot . dom . isSelected ( elem ) ) ;
396
408
} else {
397
- // IE9 standards mode and Chrome still fire the change event.
398
- if ( bot . userAgent . IE_DOC_9 || goog . userAgent . product . CHROME ) {
399
- assertChanges ( 1 ) ;
400
- } else {
401
- assertChanges ( 0 ) ;
402
- }
409
+ // Some browsers fire change events when the checkbox isn't toggled.
410
+ assertChanges ( firesChangeEventIfNotToggled ( ) ? 1 : 0 ) ;
403
411
assertFalse ( bot . dom . isSelected ( elem ) ) ;
404
412
}
405
413
}
You can’t perform that action at this time.
0 commit comments