@@ -469,26 +469,52 @@ describe('ngModelOptions', function() {
469469 var inputElm = helper . compileInput (
470470 '<input type="text" ng-model="name" name="alias" ' +
471471 'ng-model-options="{' +
472- 'updateOn: \'default blur\', ' +
472+ 'updateOn: \'default blur mouseup \', ' +
473473 'debounce: { default: 10000, blur: 5000 }' +
474474 '}"' +
475475 '/>' ) ;
476476
477477 helper . changeInputValueTo ( 'a' ) ;
478- expect ( $rootScope . checkbox ) . toBeUndefined ( ) ;
478+ expect ( $rootScope . name ) . toBeUndefined ( ) ;
479479 $timeout . flush ( 6000 ) ;
480- expect ( $rootScope . checkbox ) . toBeUndefined ( ) ;
480+ expect ( $rootScope . name ) . toBeUndefined ( ) ;
481481 $timeout . flush ( 4000 ) ;
482482 expect ( $rootScope . name ) . toEqual ( 'a' ) ;
483+
483484 helper . changeInputValueTo ( 'b' ) ;
484485 browserTrigger ( inputElm , 'blur' ) ;
485486 $timeout . flush ( 4000 ) ;
486487 expect ( $rootScope . name ) . toEqual ( 'a' ) ;
487488 $timeout . flush ( 2000 ) ;
488489 expect ( $rootScope . name ) . toEqual ( 'b' ) ;
490+
491+ helper . changeInputValueTo ( 'c' ) ;
492+ browserTrigger ( helper . inputElm , 'mouseup' ) ;
493+ // counter-intuitively `default` in `debounce` is a catch-all
494+ expect ( $rootScope . name ) . toEqual ( 'b' ) ;
495+ $timeout . flush ( 10000 ) ;
496+ expect ( $rootScope . name ) . toEqual ( 'c' ) ;
489497 } ) ;
490498
491499
500+ it ( 'should trigger immediately for the event if not listed in the debounce list' ,
501+ function ( ) {
502+ var inputElm = helper . compileInput (
503+ '<input type="text" ng-model="name" name="alias" ' +
504+ 'ng-model-options="{' +
505+ 'updateOn: \'default blur foo\', ' +
506+ 'debounce: { blur: 5000 }' +
507+ '}"' +
508+ '/>' ) ;
509+
510+ helper . changeInputValueTo ( 'a' ) ;
511+ expect ( $rootScope . name ) . toEqual ( 'a' ) ;
512+
513+ helper . changeInputValueTo ( 'b' ) ;
514+ browserTrigger ( inputElm , 'foo' ) ;
515+ expect ( $rootScope . name ) . toEqual ( 'b' ) ;
516+ } ) ;
517+
492518 it ( 'should allow selecting different debounce timeouts for each event on checkboxes' , function ( ) {
493519 var inputElm = helper . compileInput ( '<input type="checkbox" ng-model="checkbox" ' +
494520 'ng-model-options="{ ' +
0 commit comments