Closed chancancode closed 5 years ago
ember g component-test foo
import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; module('Integration | Component | foo', function(hooks) { setupRenderingTest(hooks); test('it renders', async function(assert) { // Set any properties with this.set('myProperty', 'value'); // Handle any actions with this.set('myAction', function(val) { ... }); await render(hbs`<Foo />`); assert.equal(this.element.textContent.trim(), ''); // Template block usage: await render(hbs` <Foo> template block text </Foo> `); assert.equal(this.element.textContent.trim(), 'template block text'); }); });
ember g component-test foo/bar
import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; module('Integration | Component | foo/bar', function(hooks) { setupRenderingTest(hooks); test('it renders', async function(assert) { // Set any properties with this.set('myProperty', 'value'); // Handle any actions with this.set('myAction', function(val) { ... }); await render(hbs`{{foo/bar}}`); assert.equal(this.element.textContent.trim(), ''); // Template block usage: await render(hbs` {{#foo/bar}} template block text {{/foo/bar}} `); assert.equal(this.element.textContent.trim(), 'template block text'); }); });
We need to remove this logic: https://github.com/emberjs/ember.js/blob/master/blueprints/component-test/index.js#L108
ember g component-test foo
ember g component-test foo/bar