How can I check component's property value when component doesn't have template? In application the component is extended and template is provided that way.
//my-component.js
export default Ember.Component.extend({
foo: 'bar'
});
//my-component-test.hbs
integration: true;
test('it renders', function(assert) {
this.set('foo2', 'foo2');
this.render(hbs`{{my-component foo=foo2}}`);
assert.equal(/* ??? */, 'foo2');
});
I am not able to use this.render(hbs'{{#my-component foo=foo2}}{{foo}}{{/my-component}}');
because foo is not yielded. Accessing component directly is not possible either.
And the solution is to use unit test instead.
import { moduleForComponent, test } from 'ember-qunit';
moduleForComponent('forms/base-form', 'Unit | Component | forms/base-form field', {
unit: true
});
test('it renders', function(assert) {
const foo2 = 'foo2';
const component = this.subject({foo: foo2});
assert.equal(component.get('foo'), 'foo2');
});