Skip to content

Commit 3819c58

Browse files
chore(angularFiles): add missing files
ngMessageFormat test files were missing from angularTest ngMessages and ngAnimate were missing from karmaModules. This change highlighted a number of problems in the tests and code, which are now fixed. Closes angular#14314
1 parent 4d61d36 commit 3819c58

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/helpers/matchers.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,19 @@ beforeEach(function() {
233233
compare: generateCompare(false),
234234
negativeCompare: generateCompare(true)
235235
};
236+
function hasClass(element, selector) {
237+
if (!element.getAttribute) return false;
238+
return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " ").
239+
indexOf(" " + selector + " ") > -1);
240+
}
236241
function generateCompare(isNot) {
237242
return function(actual, clazz) {
238243
var message = function() {
239244
return "Expected '" + angular.mock.dump(actual) + "'" + (isNot ? " not " : "") + " to have class '" + clazz + "'.";
240245
};
241246
var classes = clazz.trim().split(/\s+/);
242247
for (var i = 0; i < classes.length; ++i) {
243-
if (!actual.hasClass(classes[i])) {
248+
if (!hasClass(actual[0], classes[i])) {
244249
return { pass: isNot };
245250
}
246251
}

0 commit comments

Comments
 (0)