diff options
| -rw-r--r-- | src/Angular.js | 7 | ||||
| -rw-r--r-- | test/AngularSpec.js | 32 |
2 files changed, 7 insertions, 32 deletions
diff --git a/src/Angular.js b/src/Angular.js index bdd71725..8b61970f 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -253,18 +253,11 @@ function identity($) {return $;} function valueFn(value) {return function(){ return value; };} - function extensionMap(angular, name, transform) { var extPoint; return angular[name] || (extPoint = angular[name] = function (name, fn, prop){ name = (transform || identity)(name); if (isDefined(fn)) { - if (isDefined(extPoint[name])) { - foreach(extPoint[name], function(property, key) { - if (key.charAt(0) == '$' && isUndefined(fn[key])) - fn[key] = property; - }); - } extPoint[name] = extend(fn, prop || {}); } return extPoint[name]; diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 50b296bd..62298465 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -284,25 +284,6 @@ describe('angularJsConfig', function() { }); }); -describe('extensionMap', function() { - it('should preserve $ properties on override', function() { - var extension = extensionMap({}, 'fake'); - extension('first', {$one: true, $two: true}); - var result = extension('first', {$one: false, $three: true}); - - expect(result.$one).toBeFalsy(); - expect(result.$two).toBeTruthy(); - expect(result.$three).toBeTruthy(); - }); - - it('should not preserve non-angular properties', function() { - var extension = extensionMap({}, 'fake'); - extension('first', {two: true}); - var result = extension('first', {$one: false, $three: true}); - - expect(result.two).not.toBeDefined(); - }); -}); describe('angular service', function() { it('should override services', function() { @@ -313,13 +294,14 @@ describe('angular service', function() { expect(scope.$service('fake')).toEqual('new'); }); - it('should preserve $ properties on override', function() { - angular.service('fake', {$one: true}, {$two: true}); - var result = angular.service('fake', {$third: true}); + it('should not preserve properties on override', function() { + angular.service('fake', {$one: true}, {$two: true}, {three: true}); + var result = angular.service('fake', {$four: true}); - expect(result.$one).toBeTruthy(); - expect(result.$two).toBeTruthy(); - expect(result.$third).toBeTruthy(); + expect(result.$one).toBeUndefined(); + expect(result.$two).toBeUndefined(); + expect(result.three).toBeUndefined(); + expect(result.$four).toBe(true); }); it('should not preserve non-angular properties on override', function() { |
