Skip to content

Commit 2fd3c73

Browse files
Add example of excluding disabled elements form elementFilters
1 parent f0e8a51 commit 2fd3c73

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

docs/ui-coverage/configuration/elementfilters.mdx

+32
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,35 @@ sidebar_label: elementFilters
99
# elementFilters
1010

1111
<ElementFilters />
12+
13+
### Excluding disabled elements
14+
15+
UI Coverage highlights disabled elements by default to reveal potential untested paths in your app, in case those elements become enabled later. If needed, you can exclude them from the report using the `elementFilters` configuration.
16+
17+
#### Config
18+
19+
```json
20+
{
21+
"elementFilters": [
22+
{
23+
"selector": "[disabled]",
24+
"include": false
25+
}
26+
]
27+
}
28+
```
29+
30+
#### HTML
31+
32+
```xml
33+
<body>
34+
<button data-cy='cancel'>Cancel</button>
35+
<button disabled data-cy='submit'>Submit</button>
36+
</body>
37+
```
38+
39+
#### Elements shown in UI
40+
41+
```
42+
[data-cy='cancel']
43+
```

0 commit comments

Comments
 (0)