', function() {
+ it('should pass if the dlitem has a parent
', function () {
var checkArgs = checkSetup('
My list item
');
assert.isTrue(checks.dlitem.evaluate.apply(null, checkArgs));
});
- it('should fail if the dlitem has an incorrect parent', function() {
+ it('should fail if the dt element has an incorrect parent', function () {
var checkArgs = checkSetup('');
assert.isFalse(checks.dlitem.evaluate.apply(null, checkArgs));
});
- (shadowSupport.v1 ? it : xit)(
- 'should return true in a shadow DOM pass',
- function() {
- var node = document.createElement('div');
- node.innerHTML = '
';
-
- var checkArgs = checkSetup(node, 'dt');
- assert.isFalse(checks.dlitem.evaluate.apply(null, checkArgs));
- }
- );
+ it('should pass if the dt element has a parent
with role="list"', function () {
+ var checkArgs = checkSetup('
My list item
');
+ assert.isTrue(checks.dlitem.evaluate.apply(null, checkArgs));
+ })
+
+ it('should fail if the dt element has a parent
with role="presentation"', function () {
+ var checkArgs = checkSetup('
My list item
');
+ assert.isFalse(checks.dlitem.evaluate.apply(null, checkArgs));
+ });
+
+ it('should fail if the dt element has a parent
with a changed role', function(){
+ var checkArgs = checkSetup('
My list item
');
+ assert.isFalse(checks.dlitem.evaluate.apply(null, checkArgs));
+ });
+
+ (shadowSupport.v1 ? it : xit)('should return true in a shadow DOM pass', function () {
+ var node = document.createElement('div');
+ node.innerHTML = '
';
+
+ var checkArgs = checkSetup(node, 'dt');
+ assert.isFalse(checks.dlitem.evaluate.apply(null, checkArgs));
+ });
});
+
+
diff --git a/test/checks/lists/listitem.js b/test/checks/lists/listitem.js
index 19af87c877..751bd6b6e9 100644
--- a/test/checks/lists/listitem.js
+++ b/test/checks/lists/listitem.js
@@ -1,63 +1,55 @@
-describe('listitem', function() {
+describe('listitem', function () {
'use strict';
var fixture = document.getElementById('fixture');
var checkSetup = axe.testUtils.checkSetup;
var shadowSupport = axe.testUtils.shadowSupport;
- afterEach(function() {
+ afterEach(function () {
fixture.innerHTML = '';
});
- it('should pass if the listitem has a parent ', function() {
+ it('should pass if the listitem has a parent ', function () {
var checkArgs = checkSetup('
My list item
');
-
assert.isTrue(checks.listitem.evaluate.apply(null, checkArgs));
});
- it('should pass if the listitem has a parent
', function() {
+ it('should pass if the listitem has a parent
', function () {
var checkArgs = checkSetup('
My list item
');
-
assert.isTrue(checks.listitem.evaluate.apply(null, checkArgs));
});
- it('should pass if the listitem has a parent role=list', function() {
- var checkArgs = checkSetup(
- '
My list item
'
- );
-
+ it('should pass if the listitem has a parent role=list', function () {
+ var checkArgs = checkSetup('
My list item
');
assert.isTrue(checks.listitem.evaluate.apply(null, checkArgs));
});
- it('should fail if the listitem has an incorrect parent', function() {
+ it('should fail if the listitem has an incorrect parent', function () {
var checkArgs = checkSetup('
My list item
');
+ assert.isFalse(checks.listitem.evaluate.apply(null, checkArgs));
+ });
+
+ it('should fail if the listitem has a parent with changed role', function () {
+ var checkArgs = checkSetup('
My list item
');
+ assert.isFalse(checks.listitem.evaluate.apply(null, checkArgs));
+ });
+
+ (shadowSupport.v1 ? it : xit)('should return true in a shadow DOM pass', function () {
+ var node = document.createElement('div');
+ node.innerHTML = '
';
-
- var checkArgs = checkSetup(node, 'li');
- assert.isFalse(checks.listitem.evaluate.apply(null, checkArgs));
- }
- );
});
diff --git a/test/checks/lists/only-dlitems.js b/test/checks/lists/only-dlitems.js
index 28ebb6d426..624624d204 100644
--- a/test/checks/lists/only-dlitems.js
+++ b/test/checks/lists/only-dlitems.js
@@ -1,4 +1,4 @@
-describe('only-dlitems', function() {
+describe('only-dlitems', function () {
'use strict';
var fixture = document.getElementById('fixture');
@@ -7,173 +7,132 @@ describe('only-dlitems', function() {
var checkContext = axe.testUtils.MockCheckContext();
- afterEach(function() {
+ afterEach(function () {
fixture.innerHTML = '';
checkContext.reset();
});
- it('should return false if the list has no contents', function() {
+ it('should return false if the list has no contents', function () {
var checkArgs = checkSetup('
');
- assert.isFalse(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return true if the list has non-dd/dt contents', function() {
+ it('should return true if the list has non-dd/dt contents', function () {
var checkArgs = checkSetup('
Not a list
');
- assert.isTrue(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isTrue(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
assert.deepEqual(checkContext._relatedNodes, [fixture.querySelector('p')]);
});
- it('should return false if the list has only a dd', function() {
+ it('should return true if the list has non-dd content through role change', function () {
+ var checkArgs = checkSetup('
Not a list
');
+
+ assert.isTrue(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
+ });
+
+ it('should return true if the list has non-dt content through role change', function () {
+ var checkArgs = checkSetup('
Not a list
');
+
+ assert.isTrue(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
+ });
+
+ it('should return false if the list has only a dd', function () {
var checkArgs = checkSetup('
A list
');
- assert.isFalse(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
+ });
+
+ it('should return true if is used along side dt with its role changed', function () {
+ var checkArgs = checkSetup('
A list
');
+ assert.isTrue(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return false if the list has only a dt', function() {
+ it('should return false if the list has only a dt', function () {
var checkArgs = checkSetup('
A list
');
- assert.isFalse(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return false if the list has dt and dd with child content', function() {
- var checkArgs = checkSetup(
- '
An item
A list
'
- );
+ it('should return false if the list has dt and dd with child content', function () {
+ var checkArgs = checkSetup('
An item
A list
');
- assert.isFalse(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return false if the list has dt and dd', function() {
- var checkArgs = checkSetup(
- '
An item
A list
'
- );
+ it('should return false if the list has dt and dd', function () {
+ var checkArgs = checkSetup('
An item
A list
');
- assert.isFalse(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return false if the list has dt, dd and a comment', function() {
- var checkArgs = checkSetup(
- '
An item
A list
'
- );
+ it('should return false if the list has dt, dd and a comment', function () {
+ var checkArgs = checkSetup('
An item
A list
');
- assert.isFalse(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return true if the list has a dt and dd with other content', function() {
- var checkArgs = checkSetup(
- '
Item one
Description
Not a list
'
- );
+ it('should return true if the list has a dt and dd with other content', function () {
+ var checkArgs = checkSetup('
Item one
Description
Not a list
');
- assert.isTrue(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isTrue(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
assert.deepEqual(checkContext._relatedNodes, [fixture.querySelector('p')]);
});
- it('should return true if the list has a textNode as a child', function() {
- var checkArgs = checkSetup(
- '
hi
hello
hi
'
- );
+ it('should return true if the list has a textNode as a child', function () {
+ var checkArgs = checkSetup('
hi
hello
hi
');
- assert.isTrue(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isTrue(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
assert.deepEqual(checkContext._relatedNodes, []);
});
- it('should return false if is used along side dt', function() {
- var checkArgs = checkSetup(
- '
A list
'
- );
+ it('should return false if is used along side dt', function () {
+ var checkArgs = checkSetup('
A list
');
- assert.isFalse(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return false if is used along side dt', function() {
- var checkArgs = checkSetup(
- '
A list
'
- );
+ it('should return false if is used along side dt', function () {
+ var checkArgs = checkSetup('
';
+ (shadowSupport.v1 ? it : xit)('should return false in a shadow DOM pass', function () {
+ var node = document.createElement('div');
+ node.innerHTML = '
';
+ (shadowSupport.v1 ? it : xit)('should return true in a shadow DOM fail', function () {
+ var node = document.createElement('div');
+ node.innerHTML = '
';
- var checkArgs = checkSetup(node, 'dl');
- assert.isTrue(
- checks['only-dlitems'].evaluate.apply(checkContext, checkArgs)
- );
- }
- );
+ var checkArgs = checkSetup(node, 'dl');
+ assert.isTrue(checks['only-dlitems'].evaluate.apply(checkContext, checkArgs));
+ });
});
diff --git a/test/checks/lists/only-listitems.js b/test/checks/lists/only-listitems.js
index 7e70bd7ac7..ef7b864e14 100644
--- a/test/checks/lists/only-listitems.js
+++ b/test/checks/lists/only-listitems.js
@@ -1,4 +1,4 @@
-describe('only-listitems', function() {
+describe('only-listitems', function () {
'use strict';
var fixture = document.getElementById('fixture');
@@ -7,158 +7,144 @@ describe('only-listitems', function() {
var checkContext = axe.testUtils.MockCheckContext();
- afterEach(function() {
+ afterEach(function () {
fixture.innerHTML = '';
checkContext.reset();
});
- it('should return false if the list has no contents', function() {
+ it('should return false if the list has no contents', function () {
var checkArgs = checkSetup('');
- assert.isFalse(
- checks['only-listitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return false if the list has whitespace', function() {
+ it('should return false if the list has only spaces as content', function () {
+ var checkArgs = checkSetup('');
+
+ assert.isFalse(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
+ });
+
+ it('should return false if the list has whitespace', function () {
var checkArgs = checkSetup('
Item
');
- assert.isFalse(
- checks['only-listitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
+ });
+
+ it('should return false if the list has only an element with role listitem', function () {
+ var checkArgs = checkSetup('
A list
');
+
+ assert.isFalse(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return false if the list has non-li comments', function() {
- var checkArgs = checkSetup(
- '
Item
'
- );
+ it('should return false if the list has only multiple mixed elements with role listitem', function () {
+ var checkArgs = checkSetup('
list
list
list
');
- assert.isFalse(
- checks['only-listitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return true if the list has non-li text contents', function() {
+ it('should return false if the list has non-li comments', function () {
+ var checkArgs = checkSetup('
Item
');
+
+ assert.isFalse(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
+ });
+
+ it('should return true if the list has non-li text contents', function () {
var checkArgs = checkSetup('
Item
Not an item');
- assert.isTrue(
- checks['only-listitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isTrue(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return true if the list has non-li contents', function() {
+ it('should return true if the list has non-li contents', function () {
var checkArgs = checkSetup('
Not a list
');
- assert.isTrue(
- checks['only-listitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isTrue(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
assert.deepEqual(checkContext._relatedNodes, [fixture.querySelector('p')]);
});
- it('should return false if the list has only an li with child content', function() {
+ it('should return false if the list has only an li with child content', function () {
var checkArgs = checkSetup('
A list
');
- assert.isFalse(
- checks['only-listitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return false if the list has only an li', function() {
+ it('should return false if the list has only an li', function () {
var checkArgs = checkSetup('
A list
');
- assert.isFalse(
- checks['only-listitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isFalse(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return true if the list has an li with other content', function() {
- var checkArgs = checkSetup(
- '
A list
Not a list
'
- );
+ it('should return true if the list has an li with other content', function () {
+ var checkArgs = checkSetup('
A list
Not a list
');
- assert.isTrue(
- checks['only-listitems'].evaluate.apply(checkContext, checkArgs)
- );
+ assert.isTrue(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
assert.deepEqual(checkContext._relatedNodes, [fixture.querySelector('p')]);
});
- it('should return false if is used along side li', function() {
- var checkArgs = checkSetup(
- '
A list
'
- );
+ it('should return false if the list has at least one li while others have their roles changed', function () {
+ var checkArgs = checkSetup('
A list item
Not a list item
');
+
+ assert.isFalse(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
+ });
- assert.isFalse(
- checks['only-listitems'].evaluate.apply(checkContext, checkArgs)
- );
+ it('should return true if the list has only li items with their roles changed', function () {
+ var checkArgs = checkSetup('
Not a list item
Not a list item
');
+ assert.isTrue(checks['only-listitems'].evaluate.apply(checkContext, checkArgs));
});
- it('should return false if is used along side li', function() {
- var checkArgs = checkSetup(
- '
A list
'
- );
+ it('should return true if is used along side only li items with their roles changed', function () {
+ var checkArgs = checkSetup('