Revert "Revert "feat(router): add angular 1.x router""
This reverts commit 298f1fb6a6
.
This commit is contained in:
38
modules/angular1_router/test/controller_introspector_spec.js
vendored
Normal file
38
modules/angular1_router/test/controller_introspector_spec.js
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
describe('$$controllerIntrospector', function () {
|
||||
|
||||
var $controllerProvider;
|
||||
|
||||
beforeEach(function() {
|
||||
module('ng');
|
||||
module('ngComponentRouter');
|
||||
module(function(_$controllerProvider_) {
|
||||
$controllerProvider = _$controllerProvider_;
|
||||
});
|
||||
});
|
||||
|
||||
it('should call the introspector function whenever a controller is registered', inject(function ($$controllerIntrospector) {
|
||||
var spy = jasmine.createSpy();
|
||||
$$controllerIntrospector(spy);
|
||||
function Ctrl(){}
|
||||
$controllerProvider.register('SomeController', Ctrl);
|
||||
|
||||
expect(spy).toHaveBeenCalledWith('some', Ctrl);
|
||||
}));
|
||||
|
||||
it('should call the introspector function whenever a controller is registered with array annotations', inject(function ($$controllerIntrospector) {
|
||||
var spy = jasmine.createSpy();
|
||||
$$controllerIntrospector(spy);
|
||||
function Ctrl(foo){}
|
||||
$controllerProvider.register('SomeController', ['foo', Ctrl]);
|
||||
|
||||
expect(spy).toHaveBeenCalledWith('some', Ctrl);
|
||||
}));
|
||||
|
||||
it('should retrieve a constructor', inject(function ($$controllerIntrospector) {
|
||||
function Ctrl(foo){}
|
||||
$controllerProvider.register('SomeController', ['foo', Ctrl]);
|
||||
expect($$controllerIntrospector.getTypeByName('SomeController')).toBe(Ctrl);
|
||||
}));
|
||||
});
|
Reference in New Issue
Block a user