Skip to content

Commit

Permalink
Add failing test for emberjs#18246
Browse files Browse the repository at this point in the history
  • Loading branch information
simonihmig committed Aug 9, 2019
1 parent fb60c41 commit 094c5a8
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions packages/@ember/-internals/metal/tests/observer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,37 @@ moduleFor(
assert.equal(count, 1, 'should have invoked observer');
}

// https://github.com/emberjs/ember.js/issues/18246
async ['@test observer should fire when computed property is modified'](assert) {
let obj = { bar: 'bar' };
defineProperty(
obj,
'foo',
computed('bar', {
get() {
return get(this, 'bar');
},
set(key, value) {
return value;
}
})
);

get(obj, 'foo');

let count = 0;
addObserver(obj, 'foo', function() {
assert.equal(get(obj, 'foo'), 'baz', 'should have invoked after prop change');
count++;
});

set(obj, 'foo', 'baz');
await runLoopSettled();

assert.equal(count, 1, 'should have invoked observer');
assert.equal(get(obj, 'foo'), 'baz', 'computed should have correct value');
}

async ['@test observer should continue to fire after dependent properties are accessed'](
assert
) {
Expand Down

0 comments on commit 094c5a8

Please sign in to comment.