Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Addresses issue #301 (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricksbrown authored and addyosmani committed Sep 14, 2016
1 parent da3e226 commit 7d778f7
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions test/audits/role-tooltip-requires-described-by-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,31 +91,35 @@ test('a hidden tooltip without a corresponding aria-describedby should not fail'
});

// #269
test('a tooltip without an ID doesn\'t cause an exception', function() {
test('a tooltip without an ID doesn\'t cause an exception', function(assert) {
var fixture = document.getElementById('qunit-fixture');
var tooltip = document.createElement('div');
fixture.appendChild(tooltip);
tooltip.setAttribute('role', 'tooltip');
try {
deepEqual(
axs.AuditRules.getRule('roleTooltipRequiresDescribedby').run({ scope: fixture }),
{ elements: [tooltip], result: axs.constants.AuditResult.FAIL }
);
var config = {
ruleName: 'roleTooltipRequiresDescribedby',
expected: axs.constants.AuditResult.FAIL,
elements: [tooltip]
};
assert.runRule(config);
} catch (e) {
ok(false, 'Running roleTooltipRequiresDescribedby threw an exception: ' + e.message);
}
});

test('role tooltip with a corresponding describedby of a missing element id should fail', function() {
test('role tooltip with a corresponding describedby of a missing element id should fail', function(assert) {
var fixture = document.getElementById('qunit-fixture');
var tooltip = document.createElement('div');
var trigger = document.createElement('div');
fixture.appendChild(tooltip);
fixture.appendChild(trigger);
tooltip.setAttribute('role', 'tooltip');
trigger.setAttribute('aria-describedby', 'tooltip1');
deepEqual(
axs.AuditRules.getRule('roleTooltipRequiresDescribedby').run({ scope: fixture }),
{ elements: [tooltip], result: axs.constants.AuditResult.FAIL }
);
var config = {
ruleName: 'roleTooltipRequiresDescribedby',
expected: axs.constants.AuditResult.FAIL,
elements: [tooltip]
};
assert.runRule(config);
});

0 comments on commit 7d778f7

Please sign in to comment.