mirror of https://github.com/sveltejs/svelte
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>pull/7778/head
parent
5b29124fbd
commit
419641bb3e
@ -0,0 +1,3 @@
|
|||||||
|
<label>
|
||||||
|
<slot />
|
||||||
|
</label>
|
@ -0,0 +1 @@
|
|||||||
|
[]
|
@ -1,6 +1,12 @@
|
|||||||
|
<script>
|
||||||
|
import LabelComponent from './label.svelte'
|
||||||
|
</script>
|
||||||
|
|
||||||
<label>A</label>
|
<label>A</label>
|
||||||
<label for="id">B</label>
|
<label for="id">B</label>
|
||||||
|
|
||||||
<label>C <input type="text" /></label>
|
<label>C <input type="text" /></label>
|
||||||
<label>D <button>D</button></label>
|
<label>D <button>D</button></label>
|
||||||
<label>E <span></span></label>
|
<label>E <span></span></label>
|
||||||
|
<label>F {#if true}<input type="text" />{/if}</label>
|
||||||
|
<LabelComponent>G <input type="text" /></LabelComponent>
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"code": "a11y-label-has-associated-control",
|
"code": "a11y-label-has-associated-control",
|
||||||
"end": {
|
"end": {
|
||||||
"character": 16,
|
"character": 82,
|
||||||
"column": 16,
|
"column": 16,
|
||||||
"line": 1
|
"line": 5
|
||||||
},
|
},
|
||||||
"message": "A11y: A form label must be associated with a control.",
|
"message": "A11y: A form label must be associated with a control.",
|
||||||
"pos": 0,
|
"pos": 66,
|
||||||
"start": {
|
"start": {
|
||||||
"character": 0,
|
"character": 66,
|
||||||
"column": 0,
|
"column": 0,
|
||||||
"line": 1
|
"line": 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"code": "a11y-label-has-associated-control",
|
"code": "a11y-label-has-associated-control",
|
||||||
"end": {
|
"end": {
|
||||||
"character": 149,
|
"character": 215,
|
||||||
"column": 30,
|
"column": 30,
|
||||||
"line": 6
|
"line": 10
|
||||||
},
|
},
|
||||||
"message": "A11y: A form label must be associated with a control.",
|
"message": "A11y: A form label must be associated with a control.",
|
||||||
"pos": 119,
|
"pos": 185,
|
||||||
"start": {
|
"start": {
|
||||||
"character": 119,
|
"character": 185,
|
||||||
"column": 0,
|
"column": 0,
|
||||||
"line": 6
|
"line": 10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in new issue