aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMisko Hevery2010-04-05 21:26:52 -0700
committerMisko Hevery2010-04-05 21:26:52 -0700
commite6460685869e16b5016de975fd0ba15a7e436951 (patch)
treebdf55503a5efd7e1922b73ab8ea0ac23c4137cf9 /test
parent2107eafcde390eebbf59e829194626c488de9e29 (diff)
downloadangular.js-e6460685869e16b5016de975fd0ba15a7e436951.tar.bz2
added ng-controller directive
Diffstat (limited to 'test')
-rw-r--r--test/directivesSpec.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/directivesSpec.js b/test/directivesSpec.js
index 06a3a2dd..0a7e3c18 100644
--- a/test/directivesSpec.js
+++ b/test/directivesSpec.js
@@ -156,4 +156,19 @@ describe("directives", function(){
scope.$eval();
expect(element.css('display')).toEqual('');
});
+
+ it('should ng-controller', function(){
+ window.Greeter = function(){
+ this.greeting = 'hello';
+ };
+ window.Greeter.prototype = {
+ greet: function(name) {
+ return this.greeting + ' ' + name;
+ }
+ };
+ var scope = compile('<div ng-controller="Greeter"></div>');
+ expect(scope.greeting).toEqual('hello');
+ expect(scope.greet('misko')).toEqual('hello misko');
+ delete window.Greeter;
+ });
});