This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,8 @@ forEach({
86
86
'null' : function ( ) { return null ; } ,
87
87
'true' : function ( ) { return true ; } ,
88
88
'false' : function ( ) { return false ; } ,
89
- 'undefined' : function ( ) { }
89
+ 'undefined' : function ( ) { } ,
90
+ 'Infinity' : function ( ) { return Infinity ; }
90
91
} , function ( constantGetter , name ) {
91
92
constantGetter . constant = constantGetter . literal = constantGetter . sharedGetter = true ;
92
93
CONSTANTS [ name ] = constantGetter ;
Original file line number Diff line number Diff line change @@ -632,6 +632,25 @@ describe('parser', function() {
632
632
expect ( scope . a ) . not . toBeDefined ( ) ;
633
633
} ) ;
634
634
635
+ it ( 'should evaluate Infinity' , function ( ) {
636
+ expect ( scope . $eval ( "Infinity" ) ) . toBe ( Infinity ) ;
637
+ expect ( scope . $eval ( "a=Infinity" ) ) . toBe ( Infinity ) ;
638
+ expect ( scope . a ) . toBe ( Infinity ) ;
639
+ } ) ;
640
+
641
+ it ( 'should evaluate -Infinity' , function ( ) {
642
+ expect ( scope . $eval ( "-Infinity" ) ) . toBe ( - Infinity ) ;
643
+ expect ( scope . $eval ( "a=-Infinity" ) ) . toBe ( - Infinity ) ;
644
+ expect ( scope . a ) . toBe ( - Infinity ) ;
645
+ } ) ;
646
+
647
+ it ( 'should dereference object properties named "Inf' , function ( ) {
648
+ scope . obj = { 'Infinity' : 42 } ;
649
+ expect ( scope . $eval ( "obj.Infinity" ) ) . toBe ( 42 ) ;
650
+ expect ( scope . $eval ( "obj.Infinity = 43" ) ) . toBe ( 43 ) ;
651
+ expect ( scope . obj . Infinity ) . toBe ( 43 ) ;
652
+ } ) ;
653
+
635
654
it ( 'should allow assignment after array dereference' , function ( ) {
636
655
scope . obj = [ { } ] ;
637
656
scope . $eval ( 'obj[0].name=1' ) ;
You can’t perform that action at this time.
0 commit comments