Skip to content

Commit

Permalink
chore(angularFiles): add missing files
Browse files Browse the repository at this point in the history
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
Closes angular#14669
  • Loading branch information
Narretz authored and petebacondarwin committed May 25, 2016
1 parent bf59aa5 commit 4a5723f
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 118 deletions.
3 changes: 3 additions & 0 deletions angularFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ var angularFiles = {
'test/auto/*.js',
'test/ng/**/*.js',
'test/ngAnimate/*.js',
'test/ngMessageFormat/*.js',
'test/ngMessages/*.js',
'test/ngCookies/*.js',
'test/ngResource/*.js',
Expand Down Expand Up @@ -212,7 +213,9 @@ var angularFiles = {
'test/modules/no_bootstrap.js',
'src/ngScenario/browserTrigger.js',
'test/helpers/*.js',
'test/ngAnimate/*.js',
'test/ngMessageFormat/*.js',
'test/ngMessages/*.js',
'test/ngMock/*.js',
'test/ngCookies/*.js',
'test/ngRoute/**/*.js',
Expand Down
7 changes: 6 additions & 1 deletion test/helpers/matchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,19 @@ beforeEach(function() {
compare: generateCompare(false),
negativeCompare: generateCompare(true)
};
function hasClass(element, selector) {
if (!element.getAttribute) return false;
return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " ").
indexOf(" " + selector + " ") > -1);
}
function generateCompare(isNot) {
return function(actual, clazz) {
var message = function() {
return "Expected '" + angular.mock.dump(actual) + "'" + (isNot ? " not " : "") + " to have class '" + clazz + "'.";
};
var classes = clazz.trim().split(/\s+/);
for (var i = 0; i < classes.length; ++i) {
if (!jqLiteHasClass(actual[0], classes[i])) {
if (!hasClass(actual[0], classes[i])) {
return { pass: isNot };
}
}
Expand Down
Loading

0 comments on commit 4a5723f

Please sign in to comment.