I'm writing a meteor package and are writing some unit tests on it. The package contains some templates, so I'd like to test the templates as well. The template has an onRendered hook. In my unit test, I call function Blaze.renderWithData to render the template that I want to test. I expect the onRendered hook is called by this function. However, it doesn't.
I use jasmine to do unit test. The test code is as below:
for i in [0...tests.length]
oneGroupTests = tests[i]
describe oneGroupTests.name, ->
for i in [0...oneGroupTests.tests.length]
test = oneGroupTests.tests[i]
do (test) ->
it test.name, ->
expect(test.template).toBeDefined()
expect(test.test).toBeDefined()
div = document.createElement("div")
Blaze.renderWithData(Template[test.template], test.data, div)
if test.before
test.before($(div))
test.test($(div))
$(div).remove()
Any idea how to invoke the onRendered hook programmatically?
Thanks.