Last active
December 14, 2015 12:28
-
-
Save Jon-Biz/5086093 to your computer and use it in GitHub Desktop.
Testing Backbone js dom interactions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('displaying a model',function(){ | |
var testdata = {"title":"The Title" | |
,"description":"Test Data" | |
,"content":"Test Content"} | |
, testmodel = new App.Data.PageModel(testdata) | |
, itemview; | |
beforeEach(function(){ | |
$('<div id=domobject></div>').appendTo('body'); | |
itemview = new App.Views.ItemView({el:$("#domobject") | |
,model:testmodel | |
}); | |
itemview.render(); | |
}); | |
afterEach(function(){ | |
$('#domobject').remove(); | |
}); | |
it("the model's rendered data should | |
be retreivable from the DOM",function(){ | |
expect($('#producttext').html()) | |
.toEqual(testmodel.get('content')); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment