Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Jul 20, 2020
1 parent bb035cd commit 6fabc1b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
11 changes: 9 additions & 2 deletions test/integration/virtual-rules/aria-input-field-name.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
describe('aria-input-field-name', function() {
it('should pass for aria-label', function() {
var results = axe.runVirtualRule('aria-input-field-name', {
var node = new axe.SerialVirtualNode({
nodeName: 'div',
attributes: {
role: 'combobox',
'aria-label': 'foobar'
}
});
node.parent = null;

var results = axe.runVirtualRule('aria-input-field-name', node);

assert.lengthOf(results.passes, 1);
assert.lengthOf(results.violations, 0);
assert.lengthOf(results.incomplete, 0);
});

it('should incomplete for aria-labelledby', function() {
var results = axe.runVirtualRule('aria-input-field-name', {
var node = new axe.SerialVirtualNode({
nodeName: 'div',
attributes: {
role: 'listbox',
'aria-labelledby': 'foobar'
}
});
node.parent = null;

var results = axe.runVirtualRule('aria-input-field-name', node);

assert.lengthOf(results.passes, 0);
assert.lengthOf(results.violations, 0);
Expand All @@ -38,6 +44,7 @@ describe('aria-input-field-name', function() {
// children are required since titleText comes after subtree text
// in accessible name calculation
node.children = [];
node.parent = null;

var results = axe.runVirtualRule('aria-input-field-name', node);

Expand Down
7 changes: 6 additions & 1 deletion test/integration/virtual-rules/aria-toggle-field-name.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
describe('aria-toggle-field-name', function() {
it('should pass for aria-label', function() {
var results = axe.runVirtualRule('aria-toggle-field-name', {
var node = new axe.SerialVirtualNode({
nodeName: 'div',
attributes: {
role: 'menuitemcheckbox',
'aria-label': 'foobar'
}
});
node.parent = null;

var results = axe.runVirtualRule('aria-toggle-field-name', node);

assert.lengthOf(results.passes, 1);
assert.lengthOf(results.violations, 0);
Expand Down Expand Up @@ -38,6 +41,7 @@ describe('aria-toggle-field-name', function() {
// children are required since titleText comes after subtree text
// in accessible name calculation
node.children = [];
node.parent = null;

var results = axe.runVirtualRule('aria-toggle-field-name', node);

Expand All @@ -59,6 +63,7 @@ describe('aria-toggle-field-name', function() {
nodeValue: 'foobar'
});
node.children = [child];
node.parent = null;

var results = axe.runVirtualRule('aria-toggle-field-name', node);

Expand Down
4 changes: 2 additions & 2 deletions test/integration/virtual-rules/label.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('label', function() {
assert.lengthOf(results.inapplicable, 1);
});

it('should pass for aria-label', function() {
it('should pass for aria-label (input)', function() {
var results = axe.runVirtualRule('label', {
nodeName: 'input',
attributes: {
Expand All @@ -26,7 +26,7 @@ describe('label', function() {
assert.lengthOf(results.incomplete, 0);
});

it('should pass for aria-label', function() {
it('should pass for aria-label (textarea)', function() {
var results = axe.runVirtualRule('label', {
nodeName: 'textarea',
attributes: {
Expand Down

0 comments on commit 6fabc1b

Please sign in to comment.