Ember CLI 1.13.1 にアップグレードする前に、すべてのコンポーネントで単体テストが生成されました。コンポーネントがプロパティに依存している場合、次のように記述した可能性があります。
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');
そして、これはすべて合格/レンダリングします。
私は今、このような統合テストを書いています:
var self = this;
Ember.run(function() {
self.set('supplier', supplier);
});
this.render(hbs`{{widgets/add-update-order-item}}`);
Cannot read property 'forEach' of undefined
私が抱えている問題は、テンプレートの一部に{{each}}
supplier.pricesを超えるレンダリングエラーがあることです. テンプレートの {{each}} の直前に {{log supply}} を配置すると、 が表示されますundefined
。私の推測では、レンダー呼び出しの前にセットは発生していませんか? これを機能させるために何をする必要がありますか? 単体テスト フォームでコールバックや待機は必要ありませんでした。