aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Minar2011-01-06 11:50:24 -0800
committerIgor Minar2011-01-07 12:02:45 -0800
commit142a985f33e72ab8c86916dcb6fe6996671b1b5a (patch)
tree27db1c53716388c4cc6d12568d3421844d237c6c
parentbd5ec7c32a59317840121432dcd9700fefde1ffd (diff)
downloadangular.js-142a985f33e72ab8c86916dcb6fe6996671b1b5a.tar.bz2
Revert "Issue #51: Update extensionMap()"
This reverts commit 00ca67e4befffed00ecee81bd1ce903fe01f542a. Now that we don't have published services, we don't need to worryi about this any more and in fact this behavior is confusing because to override a service that has dependencies with a services with no dependencies one must specify $inject:[] or else the old dependencies will be injected. Conflicts: src/Angular.js test/AngularSpec.js
-rw-r--r--src/Angular.js7
-rw-r--r--test/AngularSpec.js32
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() {