dimanche 27 décembre 2015

Test'em - unit tests for html changes

I'm running my own javascript template engine ( for learning purposes ) and one of the functions maps all the nodes in the body. The function actually is preety simple:

// THE OBJECT..
    function jSTemplateEngine(){
       this.$body = {};
       //...
       this.$mapBody = function(){
            this.$body = $('body').find('*');
        }
       //...
    }
// RUNNING IT..    
    var app = new jSTemplateEngine();
    app.$mapBody();

// LOGGING IT..    
    console.log(app.$body);

So far so good, when I run index.html it runs the function, tracks the body and outputs an object with all nodes.

How can I make this a unit test out of this using testem?

Aucun commentaire:

Enregistrer un commentaire