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(axe.d.ts): RunOnly.values should not accept a RunOnlyOption #1888

Merged
merged 2 commits into from
Nov 12, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions axe.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ declare namespace axe {

type resultGroups = 'inapplicable' | 'passes' | 'incomplete' | 'violations';

type RunOnlyObject = {
type ContextObject = {
include?: string[] | string[][];
exclude?: string[] | string[][];
};

type RunCallback = (error: Error, results: AxeResults) => void;

type ElementContext = Node | string | RunOnlyObject;
type ElementContext = Node | string | ContextObject;

interface TestEngine {
name: string;
Expand All @@ -38,7 +38,7 @@ declare namespace axe {
}
interface RunOnly {
type: RunOnlyType;
values?: TagValue[] | string[] | RunOnlyObject;
values: TagValue[] | string[];
}
interface RunOptions {
runOnly?: RunOnly;
Expand Down
29 changes: 3 additions & 26 deletions doc/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ The current set of tags supported are listed in the following table:

| Tag Name | Accessibility Standard/Purpose |
| --------------- | :-----------------------------------------: |
| `wcag2a` | WCAG 2.0 & WCAG 2.1 Level A |
| `wcag2aa` | WCAG 2.0 & WCAG 2.1 Level AA |
| `wcag2a` | WCAG 2.0 & WCAG 2.1 Level A |
| `wcag2aa` | WCAG 2.0 & WCAG 2.1 Level AA |
| `wcag21a` | WCAG 2.1 Level A |
| `wcag21aa` | WCAG 2.1 Level AA |
| `section508` | Section 508 |
Expand Down Expand Up @@ -397,7 +397,7 @@ Additionally, there are a number or properties that allow configuration of diffe
| `elementRef` | `false` | Return element references in addition to the target |
| `restoreScroll` | `false` | Scrolls elements back to before axe started |
| `frameWaitTime` | `60000` | How long (in milliseconds) axe waits for a response from embedded frames before timing out |
| `preload` | `true` | Any additional assets (eg: cssom) to preload before running rules. [See here for configuration details](#preload-configuration-details) |
| `preload` | `true` | Any additional assets (eg: cssom) to preload before running rules. [See here for configuration details](#preload-configuration-details) |
| `performanceTimer` | `false` | Log rule performance metrics to the console |

###### Options Parameter Examples
Expand Down Expand Up @@ -519,29 +519,6 @@ axe.run(

This example includes all level A rules except for valid-lang, and in addition will include the level AA color-contrast rule.

5. Run only some tags, but exclude others

Similar to scope, the runOnly option can accept an object with an 'include' and 'exclude' property. Only those checks that match an included tag will run, except those that share a tag from the exclude list.

```js
axe.run(
{
runOnly: {
type: 'tags',
values: {
include: ['wcag2a', 'wcag2aa'],
exclude: ['experimental']
}
}
},
(err, results) => {
// ...
}
);
```

This example first includes all `wcag2a` and `wcag2aa` rules. All rules that are tagged as `experimental` are than removed from the list of rules to run.

6. Only process certain types of results

The `resultTypes` option can be used to limit the number of nodes for a rule to a maximum of one. This can be useful for improving performance on very large or complicated pages when you are only interested in certain types of results.
Expand Down
15 changes: 0 additions & 15 deletions typings/axe-core/axe-core-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,6 @@ var tagConfig = {
axe.run(context, tagConfig, (error: Error, results: axe.AxeResults) => {
console.log(error || results);
});
axe.run(
context,
{
runOnly: {
type: 'tags',
values: {
include: ['wcag2a', 'wcag2aa'],
exclude: ['experimental']
}
}
},
(error: Error, results: axe.AxeResults) => {
console.log(error || results);
}
);
axe.run(
context,
{
Expand Down