mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
test(matchers.js): make toHaveClass matcher work better for SVG+jQuery
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user