Skip to content

Commit

Permalink
Merge pull request #15849 from bekzod/chain-fix
Browse files Browse the repository at this point in the history
[BUGFIX release] fix issue with unchaining ChainNodes
  • Loading branch information
rwjblue authored Nov 12, 2017
2 parents 1fe2274 + 250e10a commit 5b3a22c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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');
});

0 comments on commit 5b3a22c

Please sign in to comment.