mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
added ng-controller directive
This commit is contained in:
@@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user