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

Commit 7d778f7

Browse files
ricksbrownaddyosmani
authored andcommitted
Addresses issue #301 (#303)
1 parent da3e226 commit 7d778f7

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

test/audits/role-tooltip-requires-described-by-test.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,31 +91,35 @@ test('a hidden tooltip without a corresponding aria-describedby should not fail'
9191
});
9292

9393
// #269
94-
test('a tooltip without an ID doesn\'t cause an exception', function() {
94+
test('a tooltip without an ID doesn\'t cause an exception', function(assert) {
9595
var fixture = document.getElementById('qunit-fixture');
9696
var tooltip = document.createElement('div');
9797
fixture.appendChild(tooltip);
9898
tooltip.setAttribute('role', 'tooltip');
9999
try {
100-
deepEqual(
101-
axs.AuditRules.getRule('roleTooltipRequiresDescribedby').run({ scope: fixture }),
102-
{ elements: [tooltip], result: axs.constants.AuditResult.FAIL }
103-
);
100+
var config = {
101+
ruleName: 'roleTooltipRequiresDescribedby',
102+
expected: axs.constants.AuditResult.FAIL,
103+
elements: [tooltip]
104+
};
105+
assert.runRule(config);
104106
} catch (e) {
105107
ok(false, 'Running roleTooltipRequiresDescribedby threw an exception: ' + e.message);
106108
}
107109
});
108110

109-
test('role tooltip with a corresponding describedby of a missing element id should fail', function() {
111+
test('role tooltip with a corresponding describedby of a missing element id should fail', function(assert) {
110112
var fixture = document.getElementById('qunit-fixture');
111113
var tooltip = document.createElement('div');
112114
var trigger = document.createElement('div');
113115
fixture.appendChild(tooltip);
114116
fixture.appendChild(trigger);
115117
tooltip.setAttribute('role', 'tooltip');
116118
trigger.setAttribute('aria-describedby', 'tooltip1');
117-
deepEqual(
118-
axs.AuditRules.getRule('roleTooltipRequiresDescribedby').run({ scope: fixture }),
119-
{ elements: [tooltip], result: axs.constants.AuditResult.FAIL }
120-
);
119+
var config = {
120+
ruleName: 'roleTooltipRequiresDescribedby',
121+
expected: axs.constants.AuditResult.FAIL,
122+
elements: [tooltip]
123+
};
124+
assert.runRule(config);
121125
});

0 commit comments

Comments
 (0)