Skip to content

Commit

Permalink
Merge pull request #13031 from Panman8201/fix-create-mergedProperties…
Browse files Browse the repository at this point in the history
…-proto

[BUGFIX release] Fix mergedProperties at create time modifying proto
  • Loading branch information
rwjblue committed Mar 2, 2016
2 parents 9578667 + fa87517 commit c7ddfb4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions packages/ember-metal/tests/mixin/merged_properties_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,29 @@ QUnit.test('mergedProperties should exist even if not explicitly set on create',
equal(get(obj, 'options').b.c, 'ccc');
});

QUnit.test('defining mergedProperties at create time should not modify the prototype', function() {
var AnObj = EmberObject.extend({
mergedProperties: ['options'],
options: {
a: 1
}
});

var objA = AnObj.create({
options: {
a: 2
}
});
var objB = AnObj.create({
options: {
a: 3
}
});

equal(get(objA, 'options').a, 2);
equal(get(objB, 'options').a, 3);
});

QUnit.test('mergedProperties\' overwriting methods can call _super', function() {
expect(4);

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-runtime/lib/system/core_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function makeCtor() {
mergedProperties.indexOf(keyName) >= 0) {
var originalValue = this[keyName];

value = assign(originalValue, value);
value = assign({}, originalValue, value);
}

if (desc) {
Expand Down

0 comments on commit c7ddfb4

Please sign in to comment.