【发布时间】:2015-09-12 19:14:45
【问题描述】:
我无法通过 yield 块表达式将编译后的 html 输入到组件中。见测试:
import { moduleForComponent, test } from 'ember-qunit';
moduleForComponent('pro-tab-link', 'Unit | Component | pro tab link', {
// Specify the other units that are required for this test
// needs: ['component:foo', 'helper:bar'],
unit: true
});
test('it renders', function(assert) {
assert.expect(3);
// Creates the component instance
var component = this.subject({
template: Ember.Handlebars.compile(
"<h1>Hello world</h1>"
)
});
console.log(component);
assert.equal(component._state, 'preRender');
var $component = this.append();
Ember.run(function() {
component.set('isOpen', true);
});
console.log(component);
console.log($component.html());
assert.equal(component._state, 'inDOM');
assert.ok(component.isOpen);
});
还有模板:
if isOpen
== yield
由于某种原因,h1 标记没有被传递到组件的产量中。我如何让这个工作?
【问题讨论】: