Thursday, 18 May 2017

How do I unit test jQuery/Ajax in Node.js

I am new to ajax/jquery/unit testing and I'm looking for someone to point me in the right direction. I am unit testing a project (so far using mocha/chai/sinon/rewire) and am now in need to test some ajax/jquery functions. I tried digging through the internet but I'm having little luck.

The project is written in node. Here is an example of a function I wish to test.

 $(document).ready(function(){

   // Click handler for the upload button
   $('.edit-image button').on('click', function() {
      // $('.overlay').css("display", "block");
      $('.overlay').fadeIn();
      $('#img-submit').removeAttr("disabled");
   });
});

How would I go about testing this and ensure that the .fadeIn() actually happens for example?



via jch84

No comments:

Post a Comment