Skip to content

Instantly share code, notes, and snippets.

@Jon-Biz
Last active December 14, 2015 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jon-Biz/5086093 to your computer and use it in GitHub Desktop.
Save Jon-Biz/5086093 to your computer and use it in GitHub Desktop.
Testing Backbone js dom interactions
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