aboutsummaryrefslogtreecommitdiffstats
path: root/test/service/interpolateSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2011-11-17 12:49:15 -0800
committerIgor Minar2011-11-30 14:49:36 -0500
commit0e1fa2aefe34fe9ba5c957efde9ae4a82df54e11 (patch)
tree88463996139a1f8433802e49c35d6b649fafb7f4 /test/service/interpolateSpec.js
parent3d0ce0ebe9ce26f54ce0527ece7a7950bc2e8368 (diff)
downloadangular.js-0e1fa2aefe34fe9ba5c957efde9ae4a82df54e11.tar.bz2
feat($interpolate): string interpolation function
Diffstat (limited to 'test/service/interpolateSpec.js')
-rw-r--r--test/service/interpolateSpec.js21
1 files changed, 21 insertions, 0 deletions
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!');
+ }));
+});