aboutsummaryrefslogtreecommitdiffstats
path: root/test/AngularSpec.js
diff options
context:
space:
mode:
authorVojta Jina2010-10-30 20:57:13 +0200
committerIgor Minar2010-11-07 14:42:03 -0800
commit00ca67e4befffed00ecee81bd1ce903fe01f542a (patch)
tree4892661454572b97997b7a29499889c21a92a39d /test/AngularSpec.js
parent91b6c5f7ffaa19f967547ae3916641fed9e0f04c (diff)
downloadangular.js-00ca67e4befffed00ecee81bd1ce903fe01f542a.tar.bz2
Issue #51: Update extensionMap()
If user override existing extension, angular properties ($) will be preserved. This piece of logic could be refactored into separate method: Something like we have extend(), addMissingProperties() - I can't find a name for this method... Closes #51
Diffstat (limited to 'test/AngularSpec.js')
-rw-r--r--test/AngularSpec.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
index bab7df18..d5005151 100644
--- a/test/AngularSpec.js
+++ b/test/AngularSpec.js
@@ -280,3 +280,23 @@ describe('angularJsConfig', function() {
ie_compat_id: 'ng-ie-compat'});
});
});
+
+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();
+ });
+});