From b167c4b6a9e10edcf829510180f60f0f019b870d Mon Sep 17 00:00:00 2001 From: Daniel Nixon Date: Tue, 27 Aug 2019 01:40:59 +1000 Subject: [PATCH] Allow html element in addition to string (#37794) --- types/jest-axe/index.d.ts | 5 ++++- types/jest-axe/jest-axe-tests.ts | 1 + types/jest-axe/tsconfig.json | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/jest-axe/index.d.ts b/types/jest-axe/index.d.ts index 506236773f..191ecb607d 100644 --- a/types/jest-axe/index.d.ts +++ b/types/jest-axe/index.d.ts @@ -34,7 +34,10 @@ export interface AxeOptions { * @param options Options to run aXe. * @returns Promise for the results of running aXe. */ -export type JestAxe = (html: string, options?: AxeOptions) => Promise; +export type JestAxe = ( + html: Element | string, + options?: AxeOptions, +) => Promise; /** * Creates a new aXe verifier function. diff --git a/types/jest-axe/jest-axe-tests.ts b/types/jest-axe/jest-axe-tests.ts index 38caeb88eb..4b95825596 100644 --- a/types/jest-axe/jest-axe-tests.ts +++ b/types/jest-axe/jest-axe-tests.ts @@ -17,3 +17,4 @@ const newJestWithOptions: JestAxe = configureAxe({ const sameJest: JestAxe = axe; expect("").toHaveNoViolations(); +expect(document.body).toHaveNoViolations(); diff --git a/types/jest-axe/tsconfig.json b/types/jest-axe/tsconfig.json index 887813c869..1889f0045d 100644 --- a/types/jest-axe/tsconfig.json +++ b/types/jest-axe/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true,