diff options
Diffstat (limited to 'test/ng/interpolateSpec.js')
| -rw-r--r-- | test/ng/interpolateSpec.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ng/interpolateSpec.js b/test/ng/interpolateSpec.js index 454d81aa..7569c0e2 100644 --- a/test/ng/interpolateSpec.js +++ b/test/ng/interpolateSpec.js @@ -149,6 +149,29 @@ describe('$interpolate', function() { }); + describe('isTrustedContext', function() { + it('should NOT interpolate a multi-part expression when isTrustedContext is true', inject(function($interpolate) { + var isTrustedContext = true; + expect(function() { + $interpolate('constant/{{var}}', true, isTrustedContext); + }).toThrow( + "[$interpolate:noconcat] Error while interpolating: constant/{{var}}\nYou may not use " + + "multiple expressions when interpolating this expression."); + expect(function() { + $interpolate('{{foo}}{{bar}}', true, isTrustedContext); + }).toThrow( + "[$interpolate:noconcat] Error while interpolating: {{foo}}{{bar}}\nYou may not use " + + "multiple expressions when interpolating this expression."); + })); + + it('should interpolate a multi-part expression when isTrustedContext is false', inject(function($interpolate) { + expect($interpolate('some/{{id}}')()).toEqual('some/'); + expect($interpolate('some/{{id}}')({id: 1})).toEqual('some/1'); + expect($interpolate('{{foo}}{{bar}}')({foo: 1, bar: 2})).toEqual('12'); + })); + }); + + describe('startSymbol', function() { beforeEach(module(function($interpolateProvider) { @@ -199,4 +222,5 @@ describe('$interpolate', function() { expect($interpolate.endSymbol()).toBe('))'); })); }); + }); |
