【发布时间】:2014-12-10 23:27:00
【问题描述】:
我正在编写一个验收测试,其中包含我编写的 Ember 组件。该组件包装了redactor 插件。
模板的相关部分是
<label>Let's begin</label>
{{x-redactor value=lesson.intro}}
测试看起来像这样:
test('I can edit the lesson title', function() {
visit('/');
$('.Lesson-intro [contenteditable="true"]').html('<p>Blah</p>');
andThen(() => {
var lesson = App.__container__.lookup('controller:application').get('attrs.lesson');
equal(lesson.get('intro'), '<p>Blah</p>');
});
});
{{x-redactor}} 组件没有及时完成其初始化工作,以便测试更改其值。有没有办法解决这个问题(或编写测试的更好方法)?
【问题讨论】:
标签: ember.js