@@ -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
} ) ) ;
@@ -32,6 +33,31 @@ describe('$interpolate', function() {
32
33
} ) ) ;
33
34
34
35
36
+ it ( 'should ignore undefined model' , inject ( function ( $interpolate ) {
37
+ expect ( $interpolate ( "Hello {{'World' + foo}}" ) ( ) ) . toEqual ( 'Hello World' ) ;
38
+ } ) ) ;
39
+
40
+
41
+ it ( 'should ignore undefined return value' , inject ( function ( $interpolate , $rootScope ) {
42
+ $rootScope . foo = function ( ) { return undefined } ;
43
+ expect ( $interpolate ( "Hello {{'World' + foo()}}" ) ( $rootScope ) ) . toEqual ( 'Hello World' ) ;
44
+ } ) ) ;
45
+
46
+
47
+ describe ( 'provider' , function ( ) {
48
+ beforeEach ( module ( function ( $interpolateProvider ) {
49
+ $interpolateProvider . startSymbol ( '--' ) ;
50
+ $interpolateProvider . endSymbol ( '--' ) ;
51
+ } ) ) ;
52
+
53
+ it ( 'should not get confused with same markers' , inject ( function ( $interpolate ) {
54
+ expect ( $interpolate ( '---' ) . parts ) . toEqual ( [ '---' ] ) ;
55
+ expect ( $interpolate ( '----' ) ( ) ) . toEqual ( '' ) ;
56
+ expect ( $interpolate ( '--1--' ) ( ) ) . toEqual ( '1' ) ;
57
+ } ) ) ;
58
+ } ) ;
59
+
60
+
35
61
describe ( 'parseBindings' , function ( ) {
36
62
it ( 'should Parse Text With No Bindings' , inject ( function ( $interpolate ) {
37
63
var parts = $interpolate ( "a" ) . parts ;
0 commit comments