Skip to content

Commit

Permalink
fix(axe.d.ts): RunOnly.values should not accept a RunOnlyOption (#1888)
Browse files Browse the repository at this point in the history
* fix(axe.d.ts): RunOnly.values should not acccept a RunOnlyOption

* update docs and test
  • Loading branch information
straker committed Nov 12, 2019
1 parent b4dcab9 commit b68aa19
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 44 deletions.
6 changes: 3 additions & 3 deletions axe.d.ts
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
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
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

0 comments on commit b68aa19

Please sign in to comment.