Skip to content

Commit 3dea4a3

Browse files
committed
test(matchers.js): make toHaveClass matcher work better for SVG+jQuery
1 parent c93924e commit 3dea4a3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/helpers/matchers.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,13 @@ beforeEach(function() {
167167
this.message = function() {
168168
return "Expected '" + angular.mock.dump(this.actual) + "' to have class '" + clazz + "'.";
169169
};
170-
return this.actual.hasClass ?
171-
this.actual.hasClass(clazz) :
172-
angular.element(this.actual).hasClass(clazz);
170+
var classes = clazz.trim().split(/\s+/);
171+
for (var i=0; i<classes.length; ++i) {
172+
if (!jqLiteHasClass(this.actual[0], classes[i])) {
173+
return false;
174+
}
175+
}
176+
return true;
173177
},
174178

175179
toThrowMatching: function(expected) {

0 commit comments

Comments
 (0)