Ember验收测试:检查该按钮是否启用
问题描述:
我是新来的一般性ember并试图检查(在我的验收测试中)输入有效的电子邮件后是否启用提交按钮。我试过了:Ember验收测试:检查该按钮是否启用
test('Typing email enables button', function(assert){
visit('/');
var theBtn = find('.btn-primary');
fillIn('.ember-text-field', '[email protected]');
andThen(function(){
assert.equal(theBtn.isEnabled(), true);
});
});
但是这不起作用。在指南中,我找不到find()
可能采用哪些方法。
答
您可以通过使用prop()
方法查看disabled
属性来检查按钮是否被禁用。您可以检查按钮像这样启用:
assert.equal(theBtn.prop('disabled'), false);
看看这个twiddle
至于'找到()'去,它会返回一个jQuery对象,那么什么可以这样做应该可以正常工作 – acorncom