-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'; | ||
|
@@ -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) { | ||
|