Skip to content

Commit

Permalink
Add TypeScript typings for preload options object
Browse files Browse the repository at this point in the history
  • Loading branch information
awa-xima committed Jul 23, 2024
1 parent 07c5d91 commit c867c5b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion axe.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,14 @@ declare namespace axe {
iframes?: boolean;
elementRef?: boolean;
frameWaitTime?: number;
preload?: boolean;
preload?: boolean | PreloadOptions;
performanceTimer?: boolean;
pingWaitTime?: number;
}
interface PreloadOptions {
assets: string[];
timeout?: number;
}
interface AxeResults extends EnvironmentData {
toolOptions: RunOptions;
passes: Result[];
Expand Down
7 changes: 7 additions & 0 deletions typings/axe-core/axe-core-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ axe.run(
console.log(error || results);
}
);
// axe.run preload: boolean
axe.run({ preload: false });
axe.run({ preload: true });
// axe.run preload: options
axe.run({ preload: { assets: ['cssom'] } });
axe.run({ preload: { assets: ['cssom'], timeout: 50000 } });

export async function runAsync() {
await axe.run('main'); // Single selector
await axe.run(['main']); // Array of one selector
Expand Down

0 comments on commit c867c5b

Please sign in to comment.