diff options
| author | Misko Hevery | 2012-02-22 13:28:42 -0800 |
|---|---|---|
| committer | Misko Hevery | 2012-02-22 13:28:42 -0800 |
| commit | 80edcadb1dd418dcf5adf85704c6693940c8bb28 (patch) | |
| tree | 5741696b48468a3387b6763559bff6b2be0a150b /test | |
| parent | c27a56f4da9bf89e471ac6597c135e2f19814f17 (diff) | |
| download | angular.js-80edcadb1dd418dcf5adf85704c6693940c8bb28.tar.bz2 | |
feat($provide): added constant
Diffstat (limited to 'test')
| -rw-r--r-- | test/InjectorSpec.js | 23 | ||||
| -rw-r--r-- | test/loaderSpec.js | 2 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/InjectorSpec.js b/test/InjectorSpec.js index e0cabbac..2ea5b66d 100644 --- a/test/InjectorSpec.js +++ b/test/InjectorSpec.js @@ -260,6 +260,29 @@ describe('injector', function() { }); describe('$provide', function() { + describe('constant', function() { + it('should create configuration injectable constants', function() { + var log = []; + createInjector([ + function($provide){ + $provide.constant('abc', 123); + $provide.constant({a: 'A', b:'B'}); + return function(a) { + log.push(a); + } + }, + function(abc) { + log.push(abc); + return function(b) { + log.push(b); + } + } + ]).get('abc'); + expect(log).toEqual([123, 'A', 'B']); + }); + }); + + describe('value', function() { it('should configure $provide values', function() { expect(createInjector([function($provide) { diff --git a/test/loaderSpec.js b/test/loaderSpec.js index f983c08b..5d234b6d 100644 --- a/test/loaderSpec.js +++ b/test/loaderSpec.js @@ -38,10 +38,12 @@ describe('module loader', function() { filter('f', 'ff'). directive('d', 'dd'). config('init2'). + constant('abc', 123). run('runBlock')).toBe(myModule); expect(myModule.requires).toEqual(['other']); expect(myModule._invokeQueue).toEqual([ + ['$provide', 'constant', ['abc', 123] ], ['$injector', 'invoke', ['config'] ], ['$provide', 'service', ['sk', 'sv'] ], ['$provide', 'factory', ['fk', 'fv'] ], |
