emberjs / ember.js

Ember.js - A JavaScript framework for creating ambitious web applications
https://emberjs.com
MIT License
22.47k stars 4.21k forks source link

Namespaced components tests does not use angle bracket #18242

Closed chancancode closed 5 years ago

chancancode commented 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');
  });
});
chancancode commented 5 years ago

We need to remove this logic: https://github.com/emberjs/ember.js/blob/master/blueprints/component-test/index.js#L108