From 7f2e73ce4130d11f0265691c74658615d6937e67 Mon Sep 17 00:00:00 2001 From: Steven Lambert Date: Fri, 7 Jan 2022 09:01:40 -0700 Subject: [PATCH 1/4] fix(axe.d.ts): allow Node for include/exclude object --- axe.d.ts | 4 ++-- doc/API.md | 2 +- typings/axe-core/axe-core-tests.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/axe.d.ts b/axe.d.ts index 675d9bd595..1887c03b69 100644 --- a/axe.d.ts +++ b/axe.d.ts @@ -50,8 +50,8 @@ declare namespace axe { type CrossFrameSelector = CrossTreeSelector[]; type ContextObject = { - include?: BaseSelector | Array; - exclude?: BaseSelector | Array; + include?: Node | BaseSelector | Array; + exclude?: Node | BaseSelector | Array; }; type RunCallback = (error: Error, results: AxeResults) => void; diff --git a/doc/API.md b/doc/API.md index 22dbd2ae95..8b69f77a12 100644 --- a/doc/API.md +++ b/doc/API.md @@ -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 arrays of Nodes or [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 diff --git a/typings/axe-core/axe-core-tests.ts b/typings/axe-core/axe-core-tests.ts index a572c6c095..248bfa173e 100644 --- a/typings/axe-core/axe-core-tests.ts +++ b/typings/axe-core/axe-core-tests.ts @@ -1,7 +1,7 @@ import * as axe from '../../axe'; var context: any = document; -var $fixture: any = {}; +var $fixture: NodeList = document.querySelectorAll('div'); var options = { iframes: false, selectors: false, elementRef: false }; axe.run(context, {}, (error: Error, results: axe.AxeResults) => { From cd0abcf6554def7f0c208df327cabe3a04dc72e0 Mon Sep 17 00:00:00 2001 From: Steven Lambert Date: Fri, 7 Jan 2022 09:05:36 -0700 Subject: [PATCH 2/4] typo --- doc/API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/API.md b/doc/API.md index 8b69f77a12..a6dc0dd2fc 100644 --- a/doc/API.md +++ b/doc/API.md @@ -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 Nodes or [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 From 0373475d76319de480458ddd1c1fe92f0ca06836 Mon Sep 17 00:00:00 2001 From: Steven Lambert <2433219+straker@users.noreply.github.com> Date: Fri, 7 Jan 2022 10:15:09 -0700 Subject: [PATCH 3/4] Update typings/axe-core/axe-core-tests.ts Co-authored-by: Stephen Mathieson --- typings/axe-core/axe-core-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/axe-core/axe-core-tests.ts b/typings/axe-core/axe-core-tests.ts index 248bfa173e..539fecb425 100644 --- a/typings/axe-core/axe-core-tests.ts +++ b/typings/axe-core/axe-core-tests.ts @@ -1,7 +1,7 @@ import * as axe from '../../axe'; var context: any = document; -var $fixture: NodeList = document.querySelectorAll('div'); +var $fixture = document.querySelectorAll('div'); var options = { iframes: false, selectors: false, elementRef: false }; axe.run(context, {}, (error: Error, results: axe.AxeResults) => { From 26e1543c877371123990f21a19b76858732f7dd9 Mon Sep 17 00:00:00 2001 From: Steven Lambert Date: Mon, 10 Jan 2022 10:53:45 -0700 Subject: [PATCH 4/4] use Array instead NodeList --- typings/axe-core/axe-core-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/axe-core/axe-core-tests.ts b/typings/axe-core/axe-core-tests.ts index 539fecb425..32f3e67a72 100644 --- a/typings/axe-core/axe-core-tests.ts +++ b/typings/axe-core/axe-core-tests.ts @@ -1,7 +1,7 @@ import * as axe from '../../axe'; var context: any = document; -var $fixture = document.querySelectorAll('div'); +var $fixture = [document]; var options = { iframes: false, selectors: false, elementRef: false }; axe.run(context, {}, (error: Error, results: axe.AxeResults) => {