|
2 | 2 |
|
3 | 3 | /* globals support: false */
|
4 | 4 |
|
| 5 | +describe('injector.modules', function() { |
| 6 | + it('should expose the loaded module info on the instance injector', function() { |
| 7 | + var test1 = angular.module('test1', ['test2']).info({ version: '1.1' }); |
| 8 | + var test2 = angular.module('test2', []).info({ version: '1.2' }); |
| 9 | + module('test1'); |
| 10 | + inject(['$injector', function($injector) { |
| 11 | + expect(Object.keys($injector.modules)).toEqual(['ng', 'ngLocale', 'ngMock', 'test1', 'test2']); |
| 12 | + expect($injector.modules['test1'].info()).toEqual({ version: '1.1' }); |
| 13 | + expect($injector.modules['test2'].info()).toEqual({ version: '1.2' }); |
| 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' }); |
| 33 | + }); |
| 34 | +}); |
| 35 | + |
5 | 36 | describe('injector', function() {
|
6 | 37 | var providers;
|
7 | 38 | var injector;
|
|
0 commit comments