/whois seanhandley

Why bother testing?

Wat

Let's review!

JavaScript is code. Therefore: let's unit-test it.

Sean Handley (about 2 seconds ago)

Ok! Codez!

my_awesome_page_spec.js

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!");
    });
  });
});
    

Code fail!

http://localhost:8888

Fail

Ok! Moar codez!

awesome.html

<div id="awesome"></div>
    

my_awesome_page.js

function change_status(status){
  $('div#awesome').append(status);
}
    

Code pass!

http://localhost:8888

Pass

Cool things

Questions???

Wat

/