Skip to content

Commit

Permalink
broken test for 19279
Browse files Browse the repository at this point in the history
(cherry picked from commit 4b5c19d)
  • Loading branch information
lifeart authored and kategengler committed Dec 21, 2020
1 parent 36bdc05 commit 17a0410
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion packages/@ember/-internals/metal/tests/alias_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
removeObserver,
tagForProperty,
} from '..';
import { Object as EmberObject } from '@ember/-internals/runtime';
import { Object as EmberObject, A } from '@ember/-internals/runtime';
import { moduleFor, AbstractTestCase, runLoopSettled } from 'internal-test-helpers';
import { destroy } from '@glimmer/runtime';
import { valueForTag, validateTag } from '@glimmer/validator';
Expand Down Expand Up @@ -68,6 +68,27 @@ moduleFor(
assert.equal(count, 1);
}

['@test nested aliases should trigger computed property invalidation [GH#19279]'](assert) {
const AttributeModel = EmberObject.extend({
countAdditives: alias('additives.length'),
additives: A()
});

const RootModel = EmberObject.extend({
allAdditives: computed('[email protected]', function(){
return this.metaAttributes.reduce((acc, el)=>{
return acc.concat(el.additives);
}, []);
}),
metaAttributes: A([AttributeModel.create()])
});

let model = RootModel.create();
assert.equal(model.allAdditives.length, 0);
model.metaAttributes[0].additives.pushObject('foo');
assert.equal(model.allAdditives.length, 1);
}

async [`@test inheriting an observer of the alias from the prototype then
redefining the alias on the instance to another property dependent on same key
does not call the observer twice`](assert) {
Expand Down

0 comments on commit 17a0410

Please sign in to comment.