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 issue with unchaining ChainNodes #15849

Merged
merged 2 commits into from
Nov 12, 2017
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
3 changes: 3 additions & 0 deletions packages/ember-metal/lib/chains.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,11 @@ class ChainNode {
remove(path) {
let paths = this._paths;
if (paths === undefined) { return; }

if (paths[path] > 0) {
paths[path]--;
} else {
return;
}

let key = firstKey(path);
Expand Down
13 changes: 13 additions & 0 deletions packages/ember-runtime/tests/system/object/computed_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,16 @@ QUnit.test('Calling _super in apply outside the immediate function of a CP gette

ok(emberGet(SubClass.create(), 'foo'), 'FOO', 'super value is fetched');
});

QUnit.test('observing computed.reads prop and overriding it in create() works', function() {
let Obj = EmberObject.extend({
name: computed.reads('model.name'),
nameDidChange: observer('name', function() {})
});

let obj1 = Obj.create({name: '1'});
let obj2 = Obj.create({name: '2'});

equal(obj1.get('name'), '1');
equal(obj2.get('name'), '2');
});