Skip to content

Instantly share code, notes, and snippets.

@uhhuhyeah
Created September 6, 2012 18:33
Show Gist options
  • Save uhhuhyeah/3659272 to your computer and use it in GitHub Desktop.
Save uhhuhyeah/3659272 to your computer and use it in GitHub Desktop.
How do I test this?
window.app.OutFitCollectionView = Backbone.View.extend({
// redacted code for brevity...
render: function() {
this.collection.each(this.renderOutfit);
// redacted code for brevity...
return this;
},
renderOutfit: function(outfit) {
var view = new window.app.OutfitView({model: outfit});
this.$el.append(view.render().el);
}
});
/*
My test is that calling `renderOutfit` should instantiate a new OutfitView and append it's el to
the collectionView's el.
I'd like to spy on the OutfitView's el and have it return some simple markup I can than check is
the collectionView's $el but spys are for functions, not properties.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment