@@ -15,6 +15,7 @@ describe('$interpolate', function() {
15
15
16
16
it ( 'should suppress falsy objects' , inject ( function ( $interpolate ) {
17
17
expect ( $interpolate ( '{{undefined}}' ) ( ) ) . toEqual ( '' ) ;
18
+ expect ( $interpolate ( '{{undefined+undefined}}' ) ( ) ) . toEqual ( '' ) ;
18
19
expect ( $interpolate ( '{{null}}' ) ( ) ) . toEqual ( '' ) ;
19
20
expect ( $interpolate ( '{{a.b}}' ) ( ) ) . toEqual ( '' ) ;
20
21
} ) ) ;
@@ -55,6 +56,31 @@ describe('$interpolate', function() {
55
56
} ) ) ;
56
57
57
58
59
+ it ( 'should ignore undefined model' , inject ( function ( $interpolate ) {
60
+ expect ( $interpolate ( "Hello {{'World' + foo}}" ) ( ) ) . toEqual ( 'Hello World' ) ;
61
+ } ) ) ;
62
+
63
+
64
+ it ( 'should ignore undefined return value' , inject ( function ( $interpolate , $rootScope ) {
65
+ $rootScope . foo = function ( ) { return undefined } ;
66
+ expect ( $interpolate ( "Hello {{'World' + foo()}}" ) ( $rootScope ) ) . toEqual ( 'Hello World' ) ;
67
+ } ) ) ;
68
+
69
+
70
+ describe ( 'provider' , function ( ) {
71
+ beforeEach ( module ( function ( $interpolateProvider ) {
72
+ $interpolateProvider . startSymbol ( '--' ) ;
73
+ $interpolateProvider . endSymbol ( '--' ) ;
74
+ } ) ) ;
75
+
76
+ it ( 'should not get confused with same markers' , inject ( function ( $interpolate ) {
77
+ expect ( $interpolate ( '---' ) . parts ) . toEqual ( [ '---' ] ) ;
78
+ expect ( $interpolate ( '----' ) ( ) ) . toEqual ( '' ) ;
79
+ expect ( $interpolate ( '--1--' ) ( ) ) . toEqual ( '1' ) ;
80
+ } ) ) ;
81
+ } ) ;
82
+
83
+
58
84
describe ( 'parseBindings' , function ( ) {
59
85
it ( 'should Parse Text With No Bindings' , inject ( function ( $interpolate ) {
60
86
var parts = $interpolate ( "a" ) . parts ;
0 commit comments