'
);
assert.isFalse(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
+ axe.testUtils
+ .getCheckEvaluate('only-dlitems')
+ .apply(checkContext, checkArgs)
);
});
it('should return true if there is a div with text', function() {
var checkArgs = checkSetup('
'
);
assert.isFalse(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
+ axe.testUtils
+ .getCheckEvaluate('only-dlitems')
+ .apply(checkContext, checkArgs)
);
});
it('should return true if there is a div with non-dd / dt elements', function() {
var checkArgs = checkSetup('
');
assert.isFalse(
- checks['structured-dlitems'].evaluate.apply(null, checkArgs)
+ axe.testUtils
+ .getCheckEvaluate('structured-dlitems')
+ .apply(null, checkArgs)
);
});
it('should return true if the list has only a dd', function() {
var checkArgs = checkSetup('
A list
');
- assert.isTrue(checks['structured-dlitems'].evaluate.apply(null, checkArgs));
+ assert.isTrue(
+ axe.testUtils
+ .getCheckEvaluate('structured-dlitems')
+ .apply(null, checkArgs)
+ );
});
it('should return true if the list has only a dt', function() {
var checkArgs = checkSetup('
A list
');
- assert.isTrue(checks['structured-dlitems'].evaluate.apply(null, checkArgs));
+ assert.isTrue(
+ axe.testUtils
+ .getCheckEvaluate('structured-dlitems')
+ .apply(null, checkArgs)
+ );
});
it('should return true if the list has dt and dd in the incorrect order', function() {
@@ -32,7 +42,11 @@ describe('structured-dlitems', function() {
'
A list
An item
'
);
- assert.isTrue(checks['structured-dlitems'].evaluate.apply(null, checkArgs));
+ assert.isTrue(
+ axe.testUtils
+ .getCheckEvaluate('structured-dlitems')
+ .apply(null, checkArgs)
+ );
});
it('should return true if the list has dt and dd in the correct order as non-child descendants', function() {
@@ -40,7 +54,11 @@ describe('structured-dlitems', function() {
'
'
);
assert.isFalse(
- checks['internal-link-present'].evaluate.apply(checkContext, params)
+ axe.testUtils
+ .getCheckEvaluate('internal-link-present')
+ .apply(checkContext, params)
);
});
@@ -58,7 +68,9 @@ describe('internal-link-present', function() {
'hi'
);
assert.isTrue(
- checks['internal-link-present'].evaluate.apply(checkContext, params)
+ axe.testUtils
+ .getCheckEvaluate('internal-link-present')
+ .apply(checkContext, params)
);
}
);
diff --git a/test/checks/navigation/meta-refresh.js b/test/checks/navigation/meta-refresh.js
index 99c8311112..be2a03693c 100644
--- a/test/checks/navigation/meta-refresh.js
+++ b/test/checks/navigation/meta-refresh.js
@@ -11,7 +11,7 @@ describe('meta-refresh', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('meta');
- assert.isFalse(checks['meta-refresh'].evaluate(node));
+ assert.isFalse(axe.testUtils.getCheckEvaluate('meta-refresh')(node));
});
it('should return false if content value does not start with 0', function() {
@@ -19,7 +19,7 @@ describe('meta-refresh', function() {
'';
var node = fixture.querySelector('meta');
- assert.isFalse(checks['meta-refresh'].evaluate(node));
+ assert.isFalse(axe.testUtils.getCheckEvaluate('meta-refresh')(node));
});
it('should return true if content value starts with 0', function() {
@@ -27,21 +27,21 @@ describe('meta-refresh', function() {
'';
var node = fixture.querySelector('meta');
- assert.isTrue(checks['meta-refresh'].evaluate(node));
+ assert.isTrue(axe.testUtils.getCheckEvaluate('meta-refresh')(node));
});
it('should return true if content value is 0', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('meta');
- assert.isTrue(checks['meta-refresh'].evaluate(node));
+ assert.isTrue(axe.testUtils.getCheckEvaluate('meta-refresh')(node));
});
it('should return true if there is no content value', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('meta');
- assert.isTrue(checks['meta-refresh'].evaluate(node));
+ assert.isTrue(axe.testUtils.getCheckEvaluate('meta-refresh')(node));
});
});
});
diff --git a/test/checks/navigation/p-as-heading.js b/test/checks/navigation/p-as-heading.js
index 3161b04c5f..02dcadb6a7 100644
--- a/test/checks/navigation/p-as-heading.js
+++ b/test/checks/navigation/p-as-heading.js
@@ -22,12 +22,16 @@ describe('p-as-heading', function() {
'
elm 1
elm 2
',
testOptions
);
- assert.isTrue(checks['p-as-heading'].evaluate.apply(checkContext, params));
+ assert.isTrue(
+ axe.testUtils.getCheckEvaluate('p-as-heading').apply(checkContext, params)
+ );
});
it('returns true if there is no p element following it', function() {
var params = checkSetup('
lone elm
', testOptions);
- assert.isTrue(checks['p-as-heading'].evaluate.apply(checkContext, params));
+ assert.isTrue(
+ axe.testUtils.getCheckEvaluate('p-as-heading').apply(checkContext, params)
+ );
});
it('returns false if the font-weight is heavier', function() {
@@ -35,7 +39,9 @@ describe('p-as-heading', function() {
'
',
testOptions
);
- assert.isFalse(checks['p-as-heading'].evaluate.apply(checkContext, params));
+ assert.isFalse(
+ axe.testUtils.getCheckEvaluate('p-as-heading').apply(checkContext, params)
+ );
});
it('considers styles of elements that do not contain all the text', function() {
@@ -84,7 +100,9 @@ describe('p-as-heading', function() {
'
';
axe._tree = axe.utils.getFlattenedTree(fixture);
var node = fixture.querySelector('a');
- assert.isTrue(checks['skip-link'].evaluate(node));
+ assert.isTrue(axe.testUtils.getCheckEvaluate('skip-link')(node));
});
it('should return true if the href points to an element with an name', function() {
fixture.innerHTML = 'Click Here';
axe._tree = axe.utils.getFlattenedTree(fixture);
var node = fixture.querySelector('a');
- assert.isTrue(checks['skip-link'].evaluate(node));
+ assert.isTrue(axe.testUtils.getCheckEvaluate('skip-link')(node));
});
it('should return false if the href points to a non-existent element', function() {
fixture.innerHTML =
'Click Here
Introduction
';
var node = fixture.querySelector('a');
- assert.isFalse(checks['skip-link'].evaluate(node));
+ assert.isFalse(axe.testUtils.getCheckEvaluate('skip-link')(node));
});
it('should return undefined if the target has display:none', function() {
@@ -34,7 +34,7 @@ describe('skip-link', function() {
'Click Here' +
'
Introduction
';
var node = fixture.querySelector('a');
- assert.isUndefined(checks['skip-link'].evaluate(node));
+ assert.isUndefined(axe.testUtils.getCheckEvaluate('skip-link')(node));
});
it('should return undefined if the target has aria-hidden=true', function() {
@@ -42,6 +42,6 @@ describe('skip-link', function() {
'Click Here' +
'
Introduction
';
var node = fixture.querySelector('a');
- assert.isUndefined(checks['skip-link'].evaluate(node));
+ assert.isUndefined(axe.testUtils.getCheckEvaluate('skip-link')(node));
});
});
diff --git a/test/checks/navigation/unique-frame-title.js b/test/checks/navigation/unique-frame-title.js
index 0d2727f7fb..d406392885 100644
--- a/test/checks/navigation/unique-frame-title.js
+++ b/test/checks/navigation/unique-frame-title.js
@@ -9,7 +9,7 @@ describe('unique-frame-title', function() {
it('should log title to data and return true', function() {
assert.isTrue(
- checks['unique-frame-title'].evaluate.call(checkContext, {
+ axe.testUtils.getCheckEvaluate('unique-frame-title').call(checkContext, {
title: 'bananas'
})
);
@@ -17,14 +17,14 @@ describe('unique-frame-title', function() {
});
it('should convert text to lower case', function() {
- checks['unique-frame-title'].evaluate.call(checkContext, {
+ axe.testUtils.getCheckEvaluate('unique-frame-title').call(checkContext, {
title: '\t app\t \n \rle '
});
assert.equal(checkContext._data, 'app le');
});
it('should take out space differences', function() {
- checks['unique-frame-title'].evaluate.call(checkContext, {
+ axe.testUtils.getCheckEvaluate('unique-frame-title').call(checkContext, {
title: 'APPLE'
});
assert.equal(checkContext._data, 'apple');
diff --git a/test/checks/parser/duplicate-id.js b/test/checks/parser/duplicate-id.js
index 71b5216db8..dab33a38bc 100644
--- a/test/checks/parser/duplicate-id.js
+++ b/test/checks/parser/duplicate-id.js
@@ -14,7 +14,9 @@ describe('duplicate-id', function() {
it('should return true if there is only one element with an ID', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('#target');
- assert.isTrue(checks['duplicate-id'].evaluate.call(checkContext, node));
+ assert.isTrue(
+ axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node)
+ );
assert.equal(checkContext._data, node.id);
assert.deepEqual(checkContext._relatedNodes, []);
});
@@ -22,7 +24,9 @@ describe('duplicate-id', function() {
it('should return false if there are multiple elements with an ID', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('#target');
- assert.isFalse(checks['duplicate-id'].evaluate.call(checkContext, node));
+ assert.isFalse(
+ axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node)
+ );
assert.equal(checkContext._data, node.id);
assert.deepEqual(checkContext._relatedNodes, [node.nextSibling]);
});
@@ -43,7 +47,9 @@ describe('duplicate-id', function() {
'';
var node = fixture.querySelector('[data-testelm="1"]');
- assert.isTrue(checks['duplicate-id'].evaluate.call(checkContext, node));
+ assert.isTrue(
+ axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node)
+ );
});
it('should allow overwrote ids', function() {
@@ -53,7 +59,9 @@ describe('duplicate-id', function() {
'';
var node = fixture.querySelector('[data-testelm="1"]');
- assert.isTrue(checks['duplicate-id'].evaluate.call(checkContext, node));
+ assert.isTrue(
+ axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node)
+ );
});
(shadowSupport.v1 ? it : xit)(
@@ -66,7 +74,9 @@ describe('duplicate-id', function() {
var node = shadow.querySelector('span');
fixture.appendChild(div);
- assert.isFalse(checks['duplicate-id'].evaluate.call(checkContext, node));
+ assert.isFalse(
+ axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node)
+ );
assert.lengthOf(checkContext._relatedNodes, 1);
assert.deepEqual(checkContext._relatedNodes, [shadow.querySelector('p')]);
}
@@ -81,7 +91,9 @@ describe('duplicate-id', function() {
shadow.innerHTML = '';
fixture.appendChild(node);
- assert.isTrue(checks['duplicate-id'].evaluate.call(checkContext, node));
+ assert.isTrue(
+ axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node)
+ );
assert.lengthOf(checkContext._relatedNodes, 0);
}
);
@@ -96,7 +108,9 @@ describe('duplicate-id', function() {
var node = shadow.querySelector('#target');
fixture.appendChild(div);
- assert.isTrue(checks['duplicate-id'].evaluate.call(checkContext, node));
+ assert.isTrue(
+ axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node)
+ );
assert.lengthOf(checkContext._relatedNodes, 0);
}
);
@@ -111,7 +125,9 @@ describe('duplicate-id', function() {
shadow.innerHTML = '';
fixture.appendChild(node);
- assert.isFalse(checks['duplicate-id'].evaluate.call(checkContext, node));
+ assert.isFalse(
+ axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node)
+ );
assert.lengthOf(checkContext._relatedNodes, 1);
assert.deepEqual(checkContext._relatedNodes, [node.querySelector('p')]);
}
diff --git a/test/checks/shared/aria-label.js b/test/checks/shared/aria-label.js
index 8c057a58e2..357be8d07a 100644
--- a/test/checks/shared/aria-label.js
+++ b/test/checks/shared/aria-label.js
@@ -10,23 +10,31 @@ describe('aria-label', function() {
it('should return true if an aria-label is present', function() {
var checkArgs = checkSetup('');
- assert.isTrue(checks['aria-label'].evaluate.apply(null, checkArgs));
+ assert.isTrue(
+ axe.testUtils.getCheckEvaluate('aria-label').apply(null, checkArgs)
+ );
});
it('should return false if an aria-label is not present', function() {
var checkArgs = checkSetup('');
- assert.isFalse(checks['aria-label'].evaluate.apply(null, checkArgs));
+ assert.isFalse(
+ axe.testUtils.getCheckEvaluate('aria-label').apply(null, checkArgs)
+ );
});
it('should return false if an aria-label is present, but empty', function() {
var checkArgs = checkSetup('');
- assert.isFalse(checks['aria-label'].evaluate.apply(null, checkArgs));
+ assert.isFalse(
+ axe.testUtils.getCheckEvaluate('aria-label').apply(null, checkArgs)
+ );
});
it('should collapse whitespace', function() {
var checkArgs = checkSetup(
''
);
- assert.isFalse(checks['aria-label'].evaluate.apply(null, checkArgs));
+ assert.isFalse(
+ axe.testUtils.getCheckEvaluate('aria-label').apply(null, checkArgs)
+ );
});
});
diff --git a/test/checks/shared/aria-labelledby.js b/test/checks/shared/aria-labelledby.js
index 1148474e1e..ea0d411708 100644
--- a/test/checks/shared/aria-labelledby.js
+++ b/test/checks/shared/aria-labelledby.js
@@ -17,7 +17,7 @@ describe('aria-labelledby', function() {
target.innerHTML = 'bananas';
fixtureSetup(target);
- assert.isTrue(checks['aria-labelledby'].evaluate(node));
+ assert.isTrue(axe.testUtils.getCheckEvaluate('aria-labelledby')(node));
});
it('should return true if only one element referenced by aria-labelledby has visible text', function() {
@@ -29,14 +29,14 @@ describe('aria-labelledby', function() {
target.innerHTML = 'bananas';
fixtureSetup(target);
- assert.isTrue(checks['aria-labelledby'].evaluate(node));
+ assert.isTrue(axe.testUtils.getCheckEvaluate('aria-labelledby')(node));
});
it('should return false if an aria-labelledby is not present', function() {
var node = document.createElement('div');
fixtureSetup(node);
- assert.isFalse(checks['aria-labelledby'].evaluate(node));
+ assert.isFalse(axe.testUtils.getCheckEvaluate('aria-labelledby')(node));
});
it('should return true if an aria-labelledby is present that references hidden elements', function() {
@@ -49,7 +49,7 @@ describe('aria-labelledby', function() {
target.innerHTML = 'bananas';
fixtureSetup(target);
- assert.isTrue(checks['aria-labelledby'].evaluate(node));
+ assert.isTrue(axe.testUtils.getCheckEvaluate('aria-labelledby')(node));
});
it('should return false if an aria-labelledby is present, but references an element with only hidden content', function() {
@@ -61,7 +61,7 @@ describe('aria-labelledby', function() {
target.innerHTML = 'bananas';
fixtureSetup(target);
- assert.isFalse(checks['aria-labelledby'].evaluate(node));
+ assert.isFalse(axe.testUtils.getCheckEvaluate('aria-labelledby')(node));
});
it('should return true if an aria-labelledby is present that references elements with has aria-hidden=true', function() {
@@ -74,7 +74,7 @@ describe('aria-labelledby', function() {
target.innerHTML = 'bananas';
fixtureSetup(target);
- assert.isTrue(checks['aria-labelledby'].evaluate(node));
+ assert.isTrue(axe.testUtils.getCheckEvaluate('aria-labelledby')(node));
});
it('should return false if an aria-labelledby is present that references elements with has aria-hidden=true in the content', function() {
@@ -86,6 +86,6 @@ describe('aria-labelledby', function() {
target.innerHTML = 'bananas';
fixtureSetup(target);
- assert.isFalse(checks['aria-labelledby'].evaluate(node));
+ assert.isFalse(axe.testUtils.getCheckEvaluate('aria-labelledby')(node));
});
});
diff --git a/test/checks/shared/button-has-visible-text.js b/test/checks/shared/button-has-visible-text.js
index 2d09987f92..17a33e98ef 100644
--- a/test/checks/shared/button-has-visible-text.js
+++ b/test/checks/shared/button-has-visible-text.js
@@ -14,7 +14,9 @@ describe('button-has-visible-text', function() {
var checkArgs = checkSetup('', 'button');
assert.isFalse(
- checks['button-has-visible-text'].evaluate.apply(checkContext, checkArgs)
+ axe.testUtils
+ .getCheckEvaluate('button-has-visible-text')
+ .apply(checkContext, checkArgs)
);
});
@@ -22,7 +24,9 @@ describe('button-has-visible-text', function() {
var checkArgs = checkSetup('', 'button');
assert.isTrue(
- checks['button-has-visible-text'].evaluate.apply(checkContext, checkArgs)
+ axe.testUtils
+ .getCheckEvaluate('button-has-visible-text')
+ .apply(checkContext, checkArgs)
);
assert.deepEqual(checkContext._data, 'Name');
});
@@ -34,7 +38,9 @@ describe('button-has-visible-text', function() {
);
assert.isTrue(
- checks['button-has-visible-text'].evaluate.apply(checkContext, checkArgs)
+ axe.testUtils
+ .getCheckEvaluate('button-has-visible-text')
+ .apply(checkContext, checkArgs)
);
assert.deepEqual(checkContext._data, 'Text');
});
@@ -43,7 +49,9 @@ describe('button-has-visible-text', function() {
var checkArgs = checkSetup('', '[role=button]');
assert.isFalse(
- checks['button-has-visible-text'].evaluate.apply(checkContext, checkArgs)
+ axe.testUtils
+ .getCheckEvaluate('button-has-visible-text')
+ .apply(checkContext, checkArgs)
);
});
});
diff --git a/test/checks/shared/doc-has-title.js b/test/checks/shared/doc-has-title.js
index cf2628dc4d..d79cff0369 100644
--- a/test/checks/shared/doc-has-title.js
+++ b/test/checks/shared/doc-has-title.js
@@ -10,14 +10,14 @@ describe('doc-has-title', function() {
it('should return false if title is empty', function() {
var orig = document.title;
document.title = '';
- assert.isFalse(checks['doc-has-title'].evaluate(fixture));
+ assert.isFalse(axe.testUtils.getCheckEvaluate('doc-has-title')(fixture));
document.title = orig;
});
it('should return false if title contains only whitespace', function() {
var orig = document.title;
document.title = ' \t\r\n \n \r \n\t';
- assert.isFalse(checks['doc-has-title'].evaluate(fixture));
+ assert.isFalse(axe.testUtils.getCheckEvaluate('doc-has-title')(fixture));
document.title = orig;
});
@@ -25,7 +25,7 @@ describe('doc-has-title', function() {
var orig = document.title;
document.title = 'Bananas';
- assert.isTrue(checks['doc-has-title'].evaluate(fixture));
+ assert.isTrue(axe.testUtils.getCheckEvaluate('doc-has-title')(fixture));
document.title = orig;
});
});
diff --git a/test/checks/shared/has-alt.js b/test/checks/shared/has-alt.js
index 28cb1ffa6a..4527ed1d32 100644
--- a/test/checks/shared/has-alt.js
+++ b/test/checks/shared/has-alt.js
@@ -10,21 +10,29 @@ describe('has-alt', function() {
it('should return true if an alt is present', function() {
var checkArgs = checkSetup('');
- assert.isTrue(checks['has-alt'].evaluate.apply(null, checkArgs));
+ assert.isTrue(
+ axe.testUtils.getCheckEvaluate('has-alt').apply(null, checkArgs)
+ );
});
it('should return true if an empty alt is present', function() {
var checkArgs = checkSetup('');
- assert.isTrue(checks['has-alt'].evaluate.apply(null, checkArgs));
+ assert.isTrue(
+ axe.testUtils.getCheckEvaluate('has-alt').apply(null, checkArgs)
+ );
});
it('should return true if a null alt is present', function() {
var checkArgs = checkSetup('');
- assert.isTrue(checks['has-alt'].evaluate.apply(null, checkArgs));
+ assert.isTrue(
+ axe.testUtils.getCheckEvaluate('has-alt').apply(null, checkArgs)
+ );
});
it('should return false if an alt is not present', function() {
var checkArgs = checkSetup('');
- assert.isFalse(checks['has-alt'].evaluate.apply(null, checkArgs));
+ assert.isFalse(
+ axe.testUtils.getCheckEvaluate('has-alt').apply(null, checkArgs)
+ );
});
});
diff --git a/test/checks/shared/has-visible-text.js b/test/checks/shared/has-visible-text.js
index 2baf330555..dcb2cfe649 100644
--- a/test/checks/shared/has-visible-text.js
+++ b/test/checks/shared/has-visible-text.js
@@ -15,7 +15,9 @@ describe('has-visible-text', function() {
it('should return false if there is no visible text', function() {
var params = checkSetup('');
assert.isFalse(
- checks['has-visible-text'].evaluate.apply(checkContext, params)
+ axe.testUtils
+ .getCheckEvaluate('has-visible-text')
+ .apply(checkContext, params)
);
});
@@ -24,14 +26,18 @@ describe('has-visible-text', function() {
''
);
assert.isFalse(
- checks['has-visible-text'].evaluate.apply(checkContext, params)
+ axe.testUtils
+ .getCheckEvaluate('has-visible-text')
+ .apply(checkContext, params)
);
});
it('should return true if there is visible text', function() {
var params = checkSetup('');
assert.isTrue(
- checks['has-visible-text'].evaluate.apply(checkContext, params)
+ axe.testUtils
+ .getCheckEvaluate('has-visible-text')
+ .apply(checkContext, params)
);
});
});
diff --git a/test/checks/shared/is-on-screen.js b/test/checks/shared/is-on-screen.js
index 16126f072d..6dcb0be70b 100644
--- a/test/checks/shared/is-on-screen.js
+++ b/test/checks/shared/is-on-screen.js
@@ -7,21 +7,21 @@ describe('is-on-screen', function() {
fixture.innerHTML = '