@@ -1869,12 +1869,17 @@ describe('input', function() {
1869
1869
} ) ;
1870
1870
1871
1871
it ( 'should validate even if min value changes on-the-fly' , function ( ) {
1872
- $rootScope . min = 10 ;
1872
+ $rootScope . min = undefined ;
1873
1873
var inputElm = helper . compileInput ( '<input type="number" ng-model="value" name="alias" min="{{min}}" />' ) ;
1874
+ expect ( inputElm ) . toBeValid ( ) ;
1874
1875
1875
1876
helper . changeInputValueTo ( '15' ) ;
1876
1877
expect ( inputElm ) . toBeValid ( ) ;
1877
1878
1879
+ $rootScope . min = 10 ;
1880
+ $rootScope . $digest ( ) ;
1881
+ expect ( inputElm ) . toBeValid ( ) ;
1882
+
1878
1883
$rootScope . min = 20 ;
1879
1884
$rootScope . $digest ( ) ;
1880
1885
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1910,12 +1915,17 @@ describe('input', function() {
1910
1915
} ) ;
1911
1916
1912
1917
it ( 'should validate even if the ngMin value changes on-the-fly' , function ( ) {
1913
- $rootScope . min = 10 ;
1918
+ $rootScope . min = undefined ;
1914
1919
var inputElm = helper . compileInput ( '<input type="number" ng-model="value" name="alias" ng-min="min" />' ) ;
1920
+ expect ( inputElm ) . toBeValid ( ) ;
1915
1921
1916
1922
helper . changeInputValueTo ( '15' ) ;
1917
1923
expect ( inputElm ) . toBeValid ( ) ;
1918
1924
1925
+ $rootScope . min = 10 ;
1926
+ $rootScope . $digest ( ) ;
1927
+ expect ( inputElm ) . toBeValid ( ) ;
1928
+
1919
1929
$rootScope . min = 20 ;
1920
1930
$rootScope . $digest ( ) ;
1921
1931
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1952,12 +1962,17 @@ describe('input', function() {
1952
1962
} ) ;
1953
1963
1954
1964
it ( 'should validate even if max value changes on-the-fly' , function ( ) {
1955
- $rootScope . max = 10 ;
1965
+ $rootScope . max = undefined ;
1956
1966
var inputElm = helper . compileInput ( '<input type="number" ng-model="value" name="alias" max="{{max}}" />' ) ;
1967
+ expect ( inputElm ) . toBeValid ( ) ;
1957
1968
1958
1969
helper . changeInputValueTo ( '5' ) ;
1959
1970
expect ( inputElm ) . toBeValid ( ) ;
1960
1971
1972
+ $rootScope . max = 10 ;
1973
+ $rootScope . $digest ( ) ;
1974
+ expect ( inputElm ) . toBeValid ( ) ;
1975
+
1961
1976
$rootScope . max = 0 ;
1962
1977
$rootScope . $digest ( ) ;
1963
1978
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1993,12 +2008,17 @@ describe('input', function() {
1993
2008
} ) ;
1994
2009
1995
2010
it ( 'should validate even if the ngMax value changes on-the-fly' , function ( ) {
1996
- $rootScope . max = 10 ;
2011
+ $rootScope . max = undefined ;
1997
2012
var inputElm = helper . compileInput ( '<input type="number" ng-model="value" name="alias" ng-max="max" />' ) ;
2013
+ expect ( inputElm ) . toBeValid ( ) ;
1998
2014
1999
2015
helper . changeInputValueTo ( '5' ) ;
2000
2016
expect ( inputElm ) . toBeValid ( ) ;
2001
2017
2018
+ $rootScope . max = 10 ;
2019
+ $rootScope . $digest ( ) ;
2020
+ expect ( inputElm ) . toBeValid ( ) ;
2021
+
2002
2022
$rootScope . max = 0 ;
2003
2023
$rootScope . $digest ( ) ;
2004
2024
expect ( inputElm ) . toBeInvalid ( ) ;
0 commit comments