Testing using Qunit & Mockjax

Testing using Qunit & Mockjax



I am currently learning how to use mockjax together with Qunit but have no idea how to test the following 2 functions.. the following is the code i am making use of which includes both javascript & JQuery, Could anyone help me by giving advice on how to achieve this?
$(document).ready(function(){ $("button").click(function() { var htmlFrom=$("#from").val(); var htmlTo=$("#to").val(); $("#ResultTitle").hide(); $.get ("myHTML") departure:htmlFrom, destination:htmlTo }, function(data,status) { parse(data,status,htmlFrom,htmlTo); }); });

});

function parse(data,status,htmlFrom,htmlTo) { if ((htmlFrom.length >0) && (htmlTo.length >0)) { if (data.restResponse.data.length==0) { $(".element").html("Invalid Departure/Destination"); } else { display(data); } } }