@surea11y/playwright 0.1.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +3 -3
- package/src/A11yCoreBuilder.d.ts +7 -2
package/README.md
CHANGED
|
@@ -50,6 +50,8 @@ Also see `examples/basic-scan.js` for a runnable script (`npm run example -- <ur
|
|
|
50
50
|
|
|
51
51
|
`withTags()`/`disableRules()` above have counterparts: `.withRules([...])` (only run these specific rule IDs) and `.disableTags([...])` (never run rules carrying any of these tags). All four compose the same way similar allow/deny-list options do in other accessibility testing tools, with one non-obvious rule worth knowing: a "disable" always wins over a "with" on the same ID/tag (e.g. `.withRules(['a']).disableRules(['a'])` drops `'a'` entirely), and combining `.withRules()` **and** `.withTags()` together requires a rule to satisfy *both* (surea11y's default `includeMode: 'and'` — see `../surea11y/docs/ENGINE_OPTIONS.md`), not either one.
|
|
52
52
|
|
|
53
|
+
`.exclude(selector)` above excludes globally. Pass a second argument to scope it to specific rule IDs instead: `.exclude('.mat-select', { rules: ['aria-required-children'] })` skips `.mat-select` for that rule only — every other rule still sees it. Global and rule-scoped `.exclude()` calls compose freely.
|
|
54
|
+
|
|
53
55
|
**Create one builder per scan.** `A11yCoreBuilder` is a mutable object with no reset between `.analyze()` calls — `include()`/`exclude()`/`withRules()`/`disableRules()`/`withTags()`/`disableTags()`/`options()`/`withCustomRules()` all push onto or merge into internal state that persists for the instance's lifetime. Calling one of them again before a second `.analyze()` call *accumulates* on top of the first scan's scope rather than replacing it (this is exactly what makes "call `.include()` several times for one scan," above, work — the same accumulation just also applies across separate scans if you reuse an instance). `.reportOnly()`/`.frames()`/`.elementRef()` are the exception: each call replaces the previous value instead of merging with it.
|
|
54
56
|
|
|
55
57
|
This binding works against all three Playwright engines, not just Chromium — verified with real Firefox and WebKit runs, see `tests/cross-browser.test.js`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surea11y/playwright",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Playwright binding for surea11y -- scan real, live-rendered pages for accessibility issues.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"LICENSE"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@surea11y/core": "^1.
|
|
30
|
-
"@surea11y/binding-base": "^1.
|
|
29
|
+
"@surea11y/core": "^1.1.0",
|
|
30
|
+
"@surea11y/binding-base": "^1.1.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"playwright": ">=1.0.0"
|
package/src/A11yCoreBuilder.d.ts
CHANGED
|
@@ -170,8 +170,13 @@ export class A11yCoreBuilder {
|
|
|
170
170
|
|
|
171
171
|
/** Scope the scan to one region. Call multiple times for a multi-region union. */
|
|
172
172
|
include(selector: string): this;
|
|
173
|
-
/**
|
|
174
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Skip elements matching this selector anywhere in the scanned scope.
|
|
175
|
+
* With `opts.rules`, scopes the exclusion to just the named rule ID(s)
|
|
176
|
+
* instead of globally -- on top of, not instead of, any global exclusions
|
|
177
|
+
* from other `.exclude(selector)` calls.
|
|
178
|
+
*/
|
|
179
|
+
exclude(selector: string, opts?: { rules?: string | string[] }): this;
|
|
175
180
|
/** Only run rules carrying at least one of these tags. */
|
|
176
181
|
withTags(tags: string | string[]): this;
|
|
177
182
|
/** Never run rules carrying any of these tags (applied after withTags). */
|