This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +26
-1
lines changed
2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 13
13
var ISO_DATE_REGEXP = / \d { 4 } - [ 0 1 ] \d - [ 0 - 3 ] \d T [ 0 - 2 ] \d : [ 0 - 5 ] \d : [ 0 - 5 ] \d \. \d + ( [ + - ] [ 0 - 2 ] \d : [ 0 - 5 ] \d | Z ) / ;
14
14
var URL_REGEXP = / ^ ( f t p | h t t p | h t t p s ) : \/ \/ ( \w + : { 0 , 1 } \w * @ ) ? ( \S + ) ( : [ 0 - 9 ] + ) ? ( \/ | \/ ( [ \w # ! : . ? + = & % @ ! \- \/ ] ) ) ? $ / ;
15
15
var EMAIL_REGEXP = / ^ [ a - z 0 - 9 ! # $ % & ' * + \/ = ? ^ _ ` { | } ~ . - ] + @ [ a - z 0 - 9 ] ( [ a - z 0 - 9 - ] * [ a - z 0 - 9 ] ) ? ( \. [ a - z 0 - 9 ] ( [ a - z 0 - 9 - ] * [ a - z 0 - 9 ] ) ? ) * $ / i;
16
- var NUMBER_REGEXP = / ^ \s * ( \- | \+ ) ? ( \d + | ( \d * ( \. \d * ) ) ) \s * $ / ;
16
+ var NUMBER_REGEXP = / ^ \s * ( \- | \+ ) ? ( \d + | ( \d * ( \. \d * ) ) ) ( e \+ ? \d + ) ? \s * $ / ;
17
17
var DATE_REGEXP = / ^ ( \d { 4 } ) - ( \d { 2 } ) - ( \d { 2 } ) $ / ;
18
18
var DATETIMELOCAL_REGEXP = / ^ ( \d { 4 } ) - ( \d \d ) - ( \d \d ) T ( \d \d ) : ( \d \d ) (?: : ( \d \d ) ( \. \d { 1 , 3 } ) ? ) ? $ / ;
19
19
var WEEK_REGEXP = / ^ ( \d { 4 } ) - W ( \d \d ) $ / ;
Original file line number Diff line number Diff line change @@ -1917,6 +1917,31 @@ describe('input', function() {
1917
1917
} ) ;
1918
1918
1919
1919
1920
+ it ( 'should parse exponential notation' , function ( ) {
1921
+ var inputElm = helper . compileInput ( '<input type="number" name="alias" ng-model="value" />' ) ;
1922
+
1923
+ // #.###e+##
1924
+ $rootScope . form . alias . $setViewValue ( "1.23214124123412412e+26" ) ;
1925
+ expect ( inputElm ) . toBeValid ( ) ;
1926
+ expect ( $rootScope . value ) . toBe ( 1.23214124123412412e+26 ) ;
1927
+
1928
+ // #.###e##
1929
+ $rootScope . form . alias . $setViewValue ( "1.23214124123412412e26" ) ;
1930
+ expect ( inputElm ) . toBeValid ( ) ;
1931
+ expect ( $rootScope . value ) . toBe ( 1.23214124123412412e26 ) ;
1932
+
1933
+ // ####e+##
1934
+ $rootScope . form . alias . $setViewValue ( "123214124123412412e+26" ) ;
1935
+ expect ( inputElm ) . toBeValid ( ) ;
1936
+ expect ( $rootScope . value ) . toBe ( 123214124123412412e26 ) ;
1937
+
1938
+ // ####e##
1939
+ $rootScope . form . alias . $setViewValue ( "123214124123412412e26" ) ;
1940
+ expect ( inputElm ) . toBeValid ( ) ;
1941
+ expect ( $rootScope . value ) . toBe ( 123214124123412412e26 ) ;
1942
+ } ) ;
1943
+
1944
+
1920
1945
describe ( 'min' , function ( ) {
1921
1946
1922
1947
it ( 'should validate' , function ( ) {
You can’t perform that action at this time.
0 commit comments