Skip to content

Instantly share code, notes, and snippets.

@mcansky
Created September 24, 2013 08:45
Show Gist options
  • Save mcansky/6682036 to your computer and use it in GitHub Desktop.
Save mcansky/6682036 to your computer and use it in GitHub Desktop.
testing dom manipulation with Jasmine
(function(window){
add_pic = function (options) {
$('#pic').append("<img href='http://google.com/logo.jpg'/>");
};
describe "dom manipulation", ->
beforeEach ->
el = "<div id='pic'></div>"
$(document.body).append el
afterEach ->
$('#pic').remove()
it "should add an element to pic", ->
add_pic()
expect($('#pic').children().length).toEqual 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment