如何在mocha-web-velocity上断言之前等待Blaze模板成为渲染器?

时间:2014-08-29 23:03:02

标签: meteor meteor-velocity mocha-web-velocity

我有一些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上显示的错误表示超时已达到(在浏览器控制台上我得到正确的消息)。

  1. 为什么这种方法与方法之间的行为不同?
  2. 使我的测试等待渲染模板的最佳方法是什么?

0 个答案:

没有答案