我有一些mocha-web-velocity
测试需要渲染模板。
我可以使用setTimeout:
setTimeout(function() {
chai.assert.equal($(".text-center").html(), "Something");
done()
}, 1500)
这有效,但我不想依赖超时,而是在rendered
回调上做出断言:
Template.deliver.rendered = function() {
chai.assert.equal($(".text-center").html(), "Send a deliveqewrry");
done()
}
这只能部分工作,因为错误消息被记录到浏览器的控制台中,结果UI显示错误,但是在UI上显示的错误表示超时已达到(在浏览器控制台上我得到正确的消息)。