Skip to content

Instantly share code, notes, and snippets.

@beckyconning
Created January 10, 2013 21:33
Show Gist options
  • Save beckyconning/4505987 to your computer and use it in GitHub Desktop.
Save beckyconning/4505987 to your computer and use it in GitHub Desktop.
describe("Infographic", function() {
var infographic;
beforeEach(function() {
loadFixtures('table.html');
infographic = Infographic();
$table = $('table');
});
describe("updateFromTable($table)", function() {
it("should update its data from the passed jquery table element", function() {
infographic.updateFromTable($table);
var tableCaption = $table.find('caption').text();
var infographicCaption = infographic.caption()
expect(infographic.caption()).toEqual(tableCaption);
});
});
});
var Infographic = function() {
var caption = "";
var self = {
updateFromTable: function updateFromTable($table) {
caption = $table.find('caption').text();
},
caption: function caption() {
return caption;
}
};
return self;
};
module.exports = Infographic;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment