Before upgrading to Ember CLI 1.13.1 all components generated a unit test, if my component relied on a property I may have written something like:
var supplier = var supplier = Ember.ObjectProxy.create({
...
});
// Creates the component instance
var component = this.subject();
assert.equal(component._state, 'preRender');
component.set('supplier', supplier);
// Renders the component to the page
this.render();
assert.equal(component._state, 'inDOM');
And this would pass/render all ok.
I am now writing an integration test for this like so:
var self = this;
Ember.run(function() {
self.set('supplier', supplier);
});
this.render(hbs`{{widgets/add-update-order-item}}`);
The problem I have is the render errors with Cannot read property 'forEach' of undefined
, part of the template has a {{each}}
over supplier.prices. If I put a {{log supplier}} in the template just before the {{each}} then I see undefined
. So my guess is the set hasn't happened before the render call? What do I need to do to get this working, i didn't need any callbacks or waits in the unit test form, do I now?