JavaScript is code. Therefore: let's unit-test it.
Sean Handley (about 2 seconds ago)
describe("my_awesome_page", function() { beforeEach(function() { loadFixtures("awesome.html"); }); describe("#change_status(status)", function() { it("should change the status message", function() { expect($('div#awesome').text()).toNotEqual("Awesome!"); change_status('Awesome!'); expect($('div#awesome').text()).toEqual("Awesome!"); }); }); });
<div id="awesome"></div>
function change_status(status){ $('div#awesome').append(status); }
The main Jasmine page - http://pivotal.github.com/jasmine/
The jasmine-jquery helper - https://github.com/velesin/jasmine-jquery
/