Skip to content

Commit

Permalink
test(matchers.js): make toHaveClass matcher work better for SVG+jQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
caitp committed Sep 30, 2014
1 parent a27d827 commit b6eb3fa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/helpers/matchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,13 @@ beforeEach(function() {
this.message = function() {
return "Expected '" + angular.mock.dump(this.actual) + "' to have class '" + clazz + "'.";
};
return this.actual.hasClass ?
this.actual.hasClass(clazz) :
angular.element(this.actual).hasClass(clazz);
var classes = clazz.trim().split(/\s+/);
for (var i=0; i<classes.length; ++i) {
if (!jqLiteHasClass(this.actual[0], classes[i])) {
return false;
}
}
return true;
},

toThrowMatching: function(expected) {
Expand Down

0 comments on commit b6eb3fa

Please sign in to comment.