aboutsummaryrefslogtreecommitdiffstats
path: root/test/AngularSpec.js
diff options
context:
space:
mode:
authorThomas Belin2014-01-07 16:09:37 +0100
committerCaitlin Potter2014-02-04 10:51:24 -0500
commitd2e4e499862aeca157dbe7a7422c465e7c79205e (patch)
tree6e2db182655371c002ac3ef4601d3023917e5dc8 /test/AngularSpec.js
parent0da6cc91186a04b089994293c0dfcda11851dd2d (diff)
downloadangular.js-d2e4e499862aeca157dbe7a7422c465e7c79205e.tar.bz2
fix(ngResource): don't filter "$"-prefixed properties from ngResource requests/responses
ngResource no longer filters properties prefixed with a single "$" character from requests or responses, correcting a regression introduced in 1.2.6 (cb29632a) which caused shallowCopy and shallowClearAndCopy to ignore properties prefixed with a single "$". Closes #5666 Closes #6080 Closes #6033
Diffstat (limited to 'test/AngularSpec.js')
-rw-r--r--test/AngularSpec.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
index 7fe65f4c..117e8fb0 100644
--- a/test/AngularSpec.js
+++ b/test/AngularSpec.js
@@ -190,7 +190,7 @@ describe('angular', function() {
expect(copy.key).toBe(original.key);
});
- it('should not copy $$ properties nor prototype properties', function() {
+ it('should omit "$$"-prefixed properties', function() {
var original = {$$some: true, $$: true};
var clone = {};
@@ -198,6 +198,27 @@ describe('angular', function() {
expect(clone.$$some).toBeUndefined();
expect(clone.$$).toBeUndefined();
});
+
+ it('should copy "$"-prefixed properties from copy', function() {
+ var original = {$some: true};
+ var clone = {};
+
+ expect(shallowCopy(original, clone)).toBe(clone);
+ expect(clone.$some).toBe(original.$some);
+ });
+
+ it('should omit properties from prototype chain', function() {
+ var original, clone = {};
+ function Func() {};
+ Func.prototype.hello = "world";
+
+ original = new Func();
+ original.goodbye = "world";
+
+ expect(shallowCopy(original, clone)).toBe(clone);
+ expect(clone.hello).toBeUndefined();
+ expect(clone.goodbye).toBe("world");
+ });
});
describe('elementHTML', function() {