ここにember-qunitの基本的なコンポーネント/統合テストがあります。ember-qunitはコンポーネントを統合テストでどのようにレンダリングしますか?
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('my-component', 'TODO: put something here', {
integration: true
});
test('it renders', function(assert) {
this.render(hbs`{{my-component}}`);
console.log('This is the rendered element', this.$()[0]);
assert.ok(false);
});
私はこのようなディレクトリ構造を持つ残り火アドオンを持っています
addon/
.. components/
.... my-component/
...... component.js
...... style.less
...... template.hbs
app/
.. components/
.... my-component.js
...... component.js
tests/
.. integration/
.... components/
...... my-component-test.js
{{my-component}}
がどこにあるエンバーが決定しない方法は?
これは、これと同じ調子で一種のです、私はちょうどエクスポート/インポートすることにより、addon
コンポーネントを定期的にapp
コンポーネントをリンクした
How does Ember-CLI precompile templates?
編集コメントを1として1
それ。
app/components/my-component/component.js
export { default } from 'my-application/components/my-component'
しかし、コンソールログには、これだけを示しています。慣例により
This is the rendered element <div id="ember234 class="ember-view">
<!---->
</div>
二つの質問。まず、コンポーネントの他の部分(テンプレートやスタイル(更新されたファイル構造)を含む)とアドオンの 'component.js'のように、どのように組み込みますか?第二に、コンポーネントが 'tests'と' app'で定義されている場合、これはデフォルトになっていますか? (質問は編集1に更新されました) – shane
あなたの 'component.js'から' layout'をインポートしますか?あなたはテンプレートをインポートしていないようです。 [このアドオン](https://github.com/tubitak-bilgemyy/ember-contextual-table)をご覧ください。それは統合テストを持っています。 – ykaragol
'import template from './template'を追加しようとしました。 &layout:残念ながら、addon/components/my-component/component.jsのテンプレートを使用する前に – shane