Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recursively check label children for input control (#5323)
* Recursively check label children for input control * Add another test case * Update snapshot * clean up test Co-authored-by: tanhauhau <lhtan93@gmail.com>
- Loading branch information
Showing
5 changed files
with
58 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/validator/samples/a11y-label-has-associated-control-2/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<label> | ||
<slot /> | ||
</label> |
1 change: 1 addition & 0 deletions
1
test/validator/samples/a11y-label-has-associated-control-2/warnings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
6 changes: 6 additions & 0 deletions
6
test/validator/samples/a11y-label-has-associated-control/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
<script> | ||
import LabelComponent from './label.svelte' | ||
</script> | ||
|
||
<label>A</label> | ||
<label for="id">B</label> | ||
|
||
<label>C <input type="text" /></label> | ||
<label>D <button>D</button></label> | ||
<label>E <span></span></label> | ||
<label>F {#if true}<input type="text" />{/if}</label> | ||
<LabelComponent>G <input type="text" /></LabelComponent> |
60 changes: 30 additions & 30 deletions
60
test/validator/samples/a11y-label-has-associated-control/warnings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
[ | ||
{ | ||
"code": "a11y-label-has-associated-control", | ||
"end": { | ||
"character": 16, | ||
"column": 16, | ||
"line": 1 | ||
}, | ||
"message": "A11y: A form label must be associated with a control.", | ||
"pos": 0, | ||
"start": { | ||
"character": 0, | ||
"column": 0, | ||
"line": 1 | ||
} | ||
}, | ||
{ | ||
"code": "a11y-label-has-associated-control", | ||
"end": { | ||
"character": 149, | ||
"column": 30, | ||
"line": 6 | ||
}, | ||
"message": "A11y: A form label must be associated with a control.", | ||
"pos": 119, | ||
"start": { | ||
"character": 119, | ||
"column": 0, | ||
"line": 6 | ||
} | ||
} | ||
{ | ||
"code": "a11y-label-has-associated-control", | ||
"end": { | ||
"character": 82, | ||
"column": 16, | ||
"line": 5 | ||
}, | ||
"message": "A11y: A form label must be associated with a control.", | ||
"pos": 66, | ||
"start": { | ||
"character": 66, | ||
"column": 0, | ||
"line": 5 | ||
} | ||
}, | ||
{ | ||
"code": "a11y-label-has-associated-control", | ||
"end": { | ||
"character": 215, | ||
"column": 30, | ||
"line": 10 | ||
}, | ||
"message": "A11y: A form label must be associated with a control.", | ||
"pos": 185, | ||
"start": { | ||
"character": 185, | ||
"column": 0, | ||
"line": 10 | ||
} | ||
} | ||
] |