2

I have some mocha-web-velocity tests that need the template to be rendered.

I can use setTimeout:

setTimeout(function() { chai.assert.equal($(".text-center").html(), "Something"); done() }, 1500)

This works but I would like not to depend on timeouts but to make the assertion on the rendered callback:

Template.deliver.rendered = function() { chai.assert.equal($(".text-center").html(), "Send a deliveqewrry"); done() }

This only works partially, as the error msg gets logged into the browser's console and the results UI shows an error, but the error diaplayed on the UI says that the timeout has reached (on the browser console I get the correct msg).

  1. Why is the behaviour different between this to approaches?
  2. Which is the best way to make my tests to wait for templates to be rendered?
Tomas Romero
  • 8,418
  • 11
  • 50
  • 72
  • My guess is that you've got a scoping issue going on. Could you update with more code to show the full test case you have? – Xolv.io Oct 30 '14 at 23:09
  • I have not use this code for a while, I will try to get back with more useful info later. Thanks! – Tomas Romero Oct 31 '14 at 15:01

0 Answers0