@@ -2894,18 +2894,28 @@ describe('input', function() {
2894
2894
expect ( scope . form . alias . $error . min ) . toBeFalsy ( ) ;
2895
2895
} ) ;
2896
2896
2897
- it ( 'should validate even if min value changes on-the-fly' , function ( done ) {
2897
+ it ( 'should validate even if min value changes on-the-fly' , function ( ) {
2898
2898
scope . min = 10 ;
2899
2899
compileInput ( '<input type="number" ng-model="value" name="alias" min="{{min}}" />' ) ;
2900
2900
2901
- changeInputValueTo ( '5' ) ;
2901
+ changeInputValueTo ( '15' ) ;
2902
+ expect ( inputElm ) . toBeValid ( ) ;
2903
+
2904
+ scope . min = 20 ;
2905
+ scope . $digest ( ) ;
2902
2906
expect ( inputElm ) . toBeInvalid ( ) ;
2903
2907
2904
- scope . min = 0 ;
2905
- scope . $digest ( function ( ) {
2906
- expect ( inputElm ) . toBeValid ( ) ;
2907
- done ( ) ;
2908
- } ) ;
2908
+ scope . min = null ;
2909
+ scope . $digest ( ) ;
2910
+ expect ( inputElm ) . toBeValid ( ) ;
2911
+
2912
+ scope . min = '20' ;
2913
+ scope . $digest ( ) ;
2914
+ expect ( inputElm ) . toBeInvalid ( ) ;
2915
+
2916
+ scope . min = 'abc' ;
2917
+ scope . $digest ( ) ;
2918
+ expect ( inputElm ) . toBeValid ( ) ;
2909
2919
} ) ;
2910
2920
} ) ;
2911
2921
@@ -2926,18 +2936,28 @@ describe('input', function() {
2926
2936
expect ( scope . form . alias . $error . max ) . toBeFalsy ( ) ;
2927
2937
} ) ;
2928
2938
2929
- it ( 'should validate even if max value changes on-the-fly' , function ( done ) {
2939
+ it ( 'should validate even if max value changes on-the-fly' , function ( ) {
2930
2940
scope . max = 10 ;
2931
2941
compileInput ( '<input type="number" ng-model="value" name="alias" max="{{max}}" />' ) ;
2932
2942
2933
2943
changeInputValueTo ( '5' ) ;
2934
2944
expect ( inputElm ) . toBeValid ( ) ;
2935
2945
2936
2946
scope . max = 0 ;
2937
- scope . $digest ( function ( ) {
2938
- expect ( inputElm ) . toBeInvalid ( ) ;
2939
- done ( ) ;
2940
- } ) ;
2947
+ scope . $digest ( ) ;
2948
+ expect ( inputElm ) . toBeInvalid ( ) ;
2949
+
2950
+ scope . max = null ;
2951
+ scope . $digest ( ) ;
2952
+ expect ( inputElm ) . toBeValid ( ) ;
2953
+
2954
+ scope . max = '4' ;
2955
+ scope . $digest ( ) ;
2956
+ expect ( inputElm ) . toBeInvalid ( ) ;
2957
+
2958
+ scope . max = 'abc' ;
2959
+ scope . $digest ( ) ;
2960
+ expect ( inputElm ) . toBeValid ( ) ;
2941
2961
} ) ;
2942
2962
} ) ;
2943
2963
0 commit comments