This is an Ember component that will need this at some point:
export default Component.extend({ filteredSubs: computed.filter('model.subs', function() { // this will always return true in development http://localhost:4200/dummy // but will always return false in test because 'this' becomes undefined return this; }) }); Dummy has a one-to-many relationship to Sub:
export default Model.extend({ subs: hasMany('sub') }); export default Model.extend({ dummy: belongsTo('dummy') }); This test fails but shouldn't:
test('it renders', function(assert) { let dummy = server.create('dummy'); server.create('sub', { dummy }); this.set('dummy', dummy); this.render(hbs`{{show-dummy model=dummy}}`); assert.equal(this.$().text().trim(), 'Hi! There are 1 sub-dummies'); }); not ok 13 Chrome 63.0 - Integration | Component | show dummy: it renders
actual: Hi! There are 0 sub-dummies
expected: Hi! There are 1 sub-dummies
- Not sure if this could be an Ember bug or ember-cli-mirage bug,
- I have isolated the issue in a fresh repo https://github.com/stephanebruckert/ember-bug-16052
- Also posted on https://github.com/emberjs/ember.js/issues/16052