mardi 1 mars 2016

Jasmine test method executed when Meteor template is rendered

I am writing unit tests in Jasmine+Velocity for a Meteor application. On the client side, some methods are being executed to set classes for HTML divs when a template is rendered. For example:

Template.text.rendered = function () {

  Meteor.call("textCheck", function (err, status) {

    var pageState       = $('#pageState');

    if (status.text.success){
      pageState.addClass('text-success');
    }else{
      pageState.addClass('text-danger');
    }
};

My problem is I don't know how to call the function when the text template is rendered through Jasmine. I searched a lot of documentation online but could not find any information on how to call Template.rendered in a Jasmine test. I am using sanjo-jasmine. Also I can't understand how to check in my test if the class has been added to the div or not. Can someone help please?

Aucun commentaire:

Enregistrer un commentaire