Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX release] Fix mergedProperties at create time modifying proto #13031

Merged
merged 1 commit into from
Mar 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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