@@ -7,7 +7,7 @@ describe("errorDisplay", function () {
7
7
beforeEach ( inject ( function ( $injector ) {
8
8
var $rootScope = $injector . get ( '$rootScope' ) ,
9
9
$compile = $injector . get ( '$compile' ) ;
10
-
10
+
11
11
$location = $injector . get ( '$location' ) ;
12
12
13
13
compileHTML = function ( code ) {
@@ -35,15 +35,15 @@ describe("errorDisplay", function () {
35
35
} ) ;
36
36
37
37
it ( 'should interpolate a template with no parameters when search parameters are present' , function ( ) {
38
- var elm ;
38
+ var elm ;
39
39
40
40
spyOn ( $location , 'search' ) . andReturn ( { p0 : 'foobaz' } ) ;
41
41
elm = compileHTML ( '<div error-display="This is a test"></div>' ) ;
42
42
expect ( elm ) . toInterpolateTo ( 'This is a test' ) ;
43
43
} ) ;
44
44
45
45
it ( 'should correctly interpolate search parameters' , function ( ) {
46
- var elm ;
46
+ var elm ;
47
47
48
48
spyOn ( $location , 'search' ) . andReturn ( { p0 : '42' } ) ;
49
49
elm = compileHTML ( '<div error-display="The answer is {0}"></div>' ) ;
@@ -65,4 +65,12 @@ describe("errorDisplay", function () {
65
65
elm = compileHTML ( '<div error-display="This {0} is {1} on {2}"></div>' ) ;
66
66
expect ( elm ) . toInterpolateTo ( 'This Fooooo is {1} on {2}' ) ;
67
67
} ) ;
68
+
69
+ it ( 'should correctly handle the empty string as an interpolation parameter' , function ( ) {
70
+ var elm ;
71
+
72
+ spyOn ( $location , 'search' ) . andReturn ( { p0 : 'test' , p1 : '' } ) ;
73
+ elm = compileHTML ( '<div error-display="This {0} is a {1}"></div>' ) ;
74
+ expect ( elm ) . toInterpolateTo ( 'This test is a ' ) ;
75
+ } ) ;
68
76
} ) ;
0 commit comments