Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typings): add proper return value to getRule #1900

Merged
merged 3 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion axe.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ declare namespace axe {
}[];
cleanup?(callback: Function): void;
}
interface RuleMetadata {
ruleId: string;
description: string;
help: string;
helpUrl: string;
tags: string[];
}

let plugins: any;

Expand Down Expand Up @@ -203,7 +210,7 @@ declare namespace axe {
* @param {Array} tags Optional array of tags
* @return {Array} Array of rules
*/
function getRules(tags?: string[]): Object[];
function getRules(tags?: string[]): RuleMetadata[];

/**
* Restores the default axe configuration
Expand Down
2 changes: 1 addition & 1 deletion doc/rule-descriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
| role-img-alt | Ensures [role='img'] elements have alternate text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a | true | true | false |
| scope-attr-valid | Ensures the scope attribute is used correctly on tables | Moderate, Critical | cat.tables, best-practice | true | true | false |
| scrollable-region-focusable | Elements that have scrollable content should be accessible by keyboard | Moderate | wcag2a, wcag211 | true | true | false |
| server-side-image-map | Ensures that server-side image maps are not used | Minor | cat.text-alternatives, wcag2a, wcag211, section508, section508.22.f | true | true | false |
| server-side-image-map | Ensures that server-side image maps are not used | Minor | cat.text-alternatives, wcag2a, wcag211, section508, section508.22.f | true | false | true |
| skip-link | Ensure all skip links have a focusable target | Moderate | cat.keyboard, best-practice | true | true | true |
| tabindex | Ensures tabindex attribute values are not greater than 0 | Serious | cat.keyboard, best-practice | true | true | false |
| table-duplicate-name | Ensure that tables do not have the same summary and caption | Minor | cat.tables, best-practice | true | true | false |
Expand Down
5 changes: 5 additions & 0 deletions typings/axe-core/axe-core-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ axe.reset();
axe.getRules(['wcag2aa']);
typeof axe.getRules() === 'object';

const rules = axe.getRules();
rules.forEach(rule => {
rule.ruleId.substr(1234);
});

// Plugins
var pluginSrc: axe.AxePlugin = {
id: 'doStuff',
Expand Down