aboutsummaryrefslogtreecommitdiffstats
path: root/test/directive/ngViewSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/directive/ngViewSpec.js')
-rw-r--r--test/directive/ngViewSpec.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/directive/ngViewSpec.js b/test/directive/ngViewSpec.js
index 52aefa3a..636e15a8 100644
--- a/test/directive/ngViewSpec.js
+++ b/test/directive/ngViewSpec.js
@@ -54,6 +54,25 @@ describe('ng-view', function() {
});
+ it('should support string controller declaration', function() {
+ var MyCtrl = jasmine.createSpy('MyCtrl');
+
+ module(function($controllerProvider, $routeProvider) {
+ $controllerProvider.register('MyCtrl', ['$scope', MyCtrl]);
+ $routeProvider.when('/foo', {controller: 'MyCtrl', template: '/tpl.html'});
+ });
+
+ inject(function($route, $location, $rootScope, $templateCache) {
+ $templateCache.put('/tpl.html', [200, '<div></div>', {}]);
+ $location.path('/foo');
+ $rootScope.$digest();
+
+ expect($route.current.controller).toBe('MyCtrl');
+ expect(MyCtrl).toHaveBeenCalledWith(element.contents().scope());
+ });
+ });
+
+
it('should load content via xhr when route changes', function() {
module(function($routeProvider) {
$routeProvider.when('/foo', {template: 'myUrl1'});