Skip to content

Instantly share code, notes, and snippets.

@searls
Created October 9, 2011 14:16
Show Gist options
  • Save searls/1273736 to your computer and use it in GitHub Desktop.
Save searls/1273736 to your computer and use it in GitHub Desktop.
Just replaced 99% of what I use jasmine-jquery for in 10 lines.
beforeEach(function() {
this.addMatchers({
toIs: function(selector) {
return this.actual.is(selector);
},
toHas: function(selector) {
return this.actual.find(selector).length > 0;
}
});
});
/* examples:
expect($result).toIs('div.pants'); //it should match this. uses is()
expect($container).toHas('.fax'); //check for children that match this. uses find()
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment