Skip to content

Commit 72e269f

Browse files
blutorangeawa-xima
authored andcommitted
fix(axe.d.ts): add typings for preload options object (#4543)
Adds the TypeScript typings for passing an object to the `preload` setting for `axe.run`, as documented here: https://www.deque.com/axe/core-documentation/api-documentation/#preload-configuration-details > Specifying an object ```js axe.run( { preload: { assets: ['cssom'], timeout: 50000 } }, (err, results) => { // ... } ); ``` Co-authored-by: Andre Wachsmuth <[email protected]>
1 parent 9eadbf1 commit 72e269f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

axe.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,14 @@ declare namespace axe {
143143
iframes?: boolean;
144144
elementRef?: boolean;
145145
frameWaitTime?: number;
146-
preload?: boolean;
146+
preload?: boolean | PreloadOptions;
147147
performanceTimer?: boolean;
148148
pingWaitTime?: number;
149149
}
150+
interface PreloadOptions {
151+
assets: string[];
152+
timeout?: number;
153+
}
150154
interface AxeResults extends EnvironmentData {
151155
toolOptions: RunOptions;
152156
passes: Result[];

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ axe.run(
3535
console.log(error || results);
3636
}
3737
);
38+
// axe.run preload: boolean
39+
axe.run({ preload: false });
40+
axe.run({ preload: true });
41+
// axe.run preload: options
42+
axe.run({ preload: { assets: ['cssom'] } });
43+
axe.run({ preload: { assets: ['cssom'], timeout: 50000 } });
44+
3845
export async function runAsync() {
3946
await axe.run('main'); // Single selector
4047
await axe.run(['main']); // Array of one selector

0 commit comments

Comments
 (0)