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

Commit

Permalink
Browse files Browse the repository at this point in the history
…y-developer-tools

* 'master' of https://github.com/GoogleChrome/accessibility-developer-tools:
  fix: `axs.utils.getAriaIdReferrers` can return null for missing referrers which breaks `roleTooltipRequiresDescribedby` (#258)
  Make the npm module requireable (#298)
  • Loading branch information
addyosmani committed Sep 11, 2016
2 parents aecb168 + b64579d commit 33609ef
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module.exports = function(grunt) {
options: {
configFile: '.eslintrc'
},
target: ['./src/js/', './src/audits/']
target: ['./src/js/', './src/audits/', './Gruntfile.js', './main.js']
},

prompt: {
Expand Down
7 changes: 7 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This exposes the ./dist Javascript file for node libraries.
// It also unwraps the main axs package so Audit and other objects are exposed
// directly in the node library

var library = require('./dist/js/axs_testing'); // eslint-disable-line no-undef

module.exports = library.axs; // eslint-disable-line no-undef
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"url": "https://github.com/GoogleChrome/accessibility-developer-tools/issues"
},
"homepage": "https://github.com/GoogleChrome/accessibility-developer-tools",
"main": "src/js/Audit.js",
"main": "main.js",
"directories": {
"test": "test"
},
Expand Down
2 changes: 1 addition & 1 deletion src/js/AccessibilityUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ axs.utils.getQuerySelectorText = function(obj) {
* single ID reference.
* @param {Element} element a potential referent.
* @param {string=} opt_attributeName Name of an ARIA attribute to limit the results to, e.g. 'aria-owns'.
* @return {NodeList} The elements that refer to this element.
* @return {NodeList} The elements that refer to this element or null.
*/
axs.utils.getAriaIdReferrers = function(element, opt_attributeName) {
var propertyToSelector = function(propertyKey) {
Expand Down
14 changes: 14 additions & 0 deletions test/audits/role-tooltip-requires-described-by-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,17 @@ test('a tooltip without an ID doesn\'t cause an exception', function() {
ok(false, 'Running roleTooltipRequiresDescribedby threw an exception: ' + e.message);
}
});

test('role tooltip with a corresponding describedby of a missing element id should fail', function() {
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 }
);
});

0 comments on commit 33609ef

Please sign in to comment.