Mocking Ajax with the JQuery Mockjax Library
Unit testing your JavaScript code to ensure everything works according to plan is a very important and tricky business. Properly testing code bits can save you a lot of time and money. This article focuses not on the general topic of unit testing JavaScript, but more specifically unit testing JQuery Ajax functions. HTML File for the Test. <! DOCTYPE HTML > <html> <head> <link rel = "stylesheet" href = "lib/qunit.css" type = "text/css" media = "screen" /> <script src = "lib/qunit.js" ></script> <script src = "lib/jquery-1.7.js" ></script> <script src = "lib/json2.js" ></script> <script src = "lib/jquery.mockjax.js" ></script> ...