Skip to content

Commit a61b9e6

Browse files
committed
add include option
1 parent 4c2f747 commit a61b9e6

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • src/platform/packages/shared/kbn-scout/src/playwright/utils

src/platform/packages/shared/kbn-scout/src/playwright/utils/axe.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,27 @@ import { AXE_OPTIONS, AXE_IMPACT_LEVELS } from '@kbn/axe-config';
1515
import type { KibanaUrl } from '../../..';
1616

1717
export interface RunA11yScanOptions {
18-
/** Optional CSS selectors to exclude from scan */
18+
/** Optional CSS selectors to include in analysis */
19+
include?: string[];
20+
/** Optional CSS selectors to exclude from analysis */
1921
exclude?: string[];
2022
/** Timeout in ms for the scan (defaults 10000) */
2123
timeoutMs?: number;
2224
}
2325

2426
const runA11yScan = async (
2527
page: Page,
26-
{ exclude = [], timeoutMs = 10000 }: RunA11yScanOptions = {}
28+
{ include = [], exclude = [], timeoutMs = 10000 }: RunA11yScanOptions = {}
2729
) => {
2830
const builder = new AxeBuilder({ page });
2931
builder.options(AXE_OPTIONS);
3032

33+
if (include) {
34+
for (const selector of include) {
35+
builder.include(selector);
36+
}
37+
}
38+
3139
if (exclude) {
3240
for (const selector of exclude) {
3341
builder.exclude(selector);

0 commit comments

Comments
 (0)