From 0e1fa2aefe34fe9ba5c957efde9ae4a82df54e11 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 17 Nov 2011 12:49:15 -0800 Subject: feat($interpolate): string interpolation function --- test/service/interpolateSpec.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/service/interpolateSpec.js (limited to 'test') diff --git a/test/service/interpolateSpec.js b/test/service/interpolateSpec.js new file mode 100644 index 00000000..8644ee0a --- /dev/null +++ b/test/service/interpolateSpec.js @@ -0,0 +1,21 @@ +'use strict'; + +describe('$interpolate', function() { + + it('should return a function when there are no bindings and textOnly is undefined', + inject(function($interpolate) { + expect(typeof $interpolate('some text')).toBe('function'); + })); + + + it('should return undefined when there are no bindings and textOnly is set to true', + inject(function($interpolate) { + expect($interpolate('some text', true)).toBeUndefined(); + })); + + + it('should return interpolation function', inject(function($interpolate, $rootScope) { + $rootScope.name = 'Misko'; + expect($interpolate('Hello {{name}}!')($rootScope)).toEqual('Hello Misko!'); + })); +}); -- cgit v1.2.3