Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 56854da

Browse files
committed
Thorough testing. Only one test added instead of two. Fixes #13951
1 parent 1144751 commit 56854da

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

test/ng/controllerSpec.js

+14-9
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,23 @@ describe('$controller', function() {
5757
expect(ctrl instanceof BarCtrl).toBe(true);
5858
});
5959

60-
it('should return true when having an existing controller', function() {
61-
var FooCtrl = function($scope) { $scope.foo = 'foo'; };
60+
it('should return true when having an existing controller, should return false otherwise', function() {
61+
var FooCtrl = function($scope) { $scope.foo = 'foo'; },
62+
BarCtrl = function($scope) { $scope.bar = 'bar'; };
6263

63-
$controllerProvider.register({FooCtrl: FooCtrl});
64-
expect($controllerProvider.has('FooCtrl')).toBe(true);
65-
});
64+
$controllerProvider.register('FooCtrl', noop);
65+
$controllerProvider.register('BarCtrl', ['dep1', 'dep2', noop]);
66+
$controllerProvider.register({
67+
'BazCtrl': noop,
68+
'QuxCtrl': ['dep1', 'dep2', noop]
69+
});
6670

67-
it('should return false when not having a non existing controller', function() {
68-
var FooCtrl = function($scope) { $scope.foo = 'foo'; };
71+
expect($controllerProvider.has('FooCtrl')).toBe(true);
72+
expect($controllerProvider.has('BarCtrl')).toBe(true);
73+
expect($controllerProvider.has('BazCtrl')).toBe(true);
74+
expect($controllerProvider.has('QuxCtrl')).toBe(true);
6975

70-
$controllerProvider.register({FooCtrl: FooCtrl});
71-
expect($controllerProvider.has('BarCtrl')).toBe(false);
76+
expect($controllerProvider.has('UnknownCtrl')).toBe(false);
7277
});
7378

7479
it('should allow registration of controllers annotated with arrays', function() {

0 commit comments

Comments
 (0)