|
3 | 3 | /* globals support: false */
|
4 | 4 |
|
5 | 5 | describe('injector.modules', function() {
|
6 |
| - it('should expose the loaded module info', function() { |
| 6 | + it('should expose the loaded module info on the instance injector', function() { |
7 | 7 | var test1 = angular.module('test1', ['test2']).info({ version: '1.1' });
|
8 | 8 | var test2 = angular.module('test2', []).info({ version: '1.2' });
|
9 | 9 | module('test1');
|
10 |
| - inject(function($injector) { |
| 10 | + inject(['$injector', function($injector) { |
11 | 11 | expect(Object.keys($injector.modules)).toEqual(['ng', 'ngLocale', 'ngMock', 'test1', 'test2']);
|
12 | 12 | expect($injector.modules['test1'].info()).toEqual({ version: '1.1' });
|
13 | 13 | expect($injector.modules['test2'].info()).toEqual({ version: '1.2' });
|
14 |
| - }); |
| 14 | + }]); |
| 15 | + }); |
| 16 | + |
| 17 | + it('should expose the loaded module info on the provider injector', function() { |
| 18 | + var providerInjector; |
| 19 | + var test1 = angular.module('test1', ['test2']).info({ version: '1.1' }); |
| 20 | + var test2 = angular.module('test2', []) |
| 21 | + .info({ version: '1.2' }) |
| 22 | + .provider('test', ['$injector', function($injector) { |
| 23 | + providerInjector = $injector; |
| 24 | + return { $get: function() {} }; |
| 25 | + }]); |
| 26 | + module('test1'); |
| 27 | + // needed to ensure that the provider blocks are executed |
| 28 | + inject(); |
| 29 | + |
| 30 | + expect(Object.keys(providerInjector.modules)).toEqual(['ng', 'ngLocale', 'ngMock', 'test1', 'test2']); |
| 31 | + expect(providerInjector.modules['test1'].info()).toEqual({ version: '1.1' }); |
| 32 | + expect(providerInjector.modules['test2'].info()).toEqual({ version: '1.2' }); |
15 | 33 | });
|
16 | 34 | });
|
17 | 35 |
|
|
0 commit comments