Skip to content

Commit

Permalink
fix(axe.d.ts): allow Node for include/exclude object (#3338)
Browse files Browse the repository at this point in the history
* fix(axe.d.ts): allow Node for include/exclude object

* typo

* Update typings/axe-core/axe-core-tests.ts

Co-authored-by: Stephen Mathieson <me@stephenmathieson.com>

* use Array instead NodeList

Co-authored-by: Stephen Mathieson <me@stephenmathieson.com>
  • Loading branch information
straker and stephenmathieson authored Jan 12, 2022
1 parent f6d7b14 commit e699939
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions axe.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ declare namespace axe {
type CrossFrameSelector = CrossTreeSelector[];

type ContextObject = {
include?: BaseSelector | Array<BaseSelector | BaseSelector[]>;
exclude?: BaseSelector | Array<BaseSelector | BaseSelector[]>;
include?: Node | BaseSelector | Array<Node | BaseSelector | BaseSelector[]>;
exclude?: Node | BaseSelector | Array<Node | BaseSelector | BaseSelector[]>;
};

type RunCallback = (error: Error, results: AxeResults) => void;
Expand Down
2 changes: 1 addition & 1 deletion doc/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ By default, `axe.run` will test the entire document. The context object is an op
The include exclude object is a JSON object with two attributes: include and exclude. Either include or exclude is required. If only `exclude` is specified; include will default to the entire `document`.

- A node, or
- An array of arrays of [CSS selectors](./developer-guide.md#supported-css-selectors)
- An array of Nodes or an array of arrays of [CSS selectors](./developer-guide.md#supported-css-selectors)
- If the nested array contains a single string, that string is the CSS selector
- If the nested array contains multiple strings
- The last string is the final CSS selector
Expand Down
2 changes: 1 addition & 1 deletion typings/axe-core/axe-core-tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as axe from '../../axe';

var context: any = document;
var $fixture: any = {};
var $fixture = [document];
var options = { iframes: false, selectors: false, elementRef: false };

axe.run(context, {}, (error: Error, results: axe.AxeResults) => {
Expand Down

0 comments on commit e699939

Please sign in to comment.