-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathform-control-has-label.test.ts
41 lines (40 loc) · 1.08 KB
/
form-control-has-label.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import rule from "../form-control-has-label";
import makeRuleTester from "./makeRuleTester";
makeRuleTester("form-control-has-label", rule, {
valid: [
"<label for=''><input type='text' /></label>",
"<input type='text' aria-label='test' />",
"<label for=''>text</label><input type='text' />",
"<input type='button'>",
`
<label>
<div>
<input type="radio" />
</div>
<div>
<slot />
</div>
</label>
`,
`
<div aria-hidden="true">
<input value="1" type="text" />
</div>
`,
{
code: "<custom-label for='input'>text</custom-label><input type='text' id='input' />",
options: [{ labelComponents: ["CustomLabel"] }]
},
"<b-form-input />"
],
invalid: [
"<input type='text' />",
"<textarea type='text'></textarea>",
"<custom-label for='input'>text</custom-label><input type='text' id='input' />",
{
code: "<div><b-form-input /></div>",
options: [{ controlComponents: ["b-form-input"] }],
errors: [{ messageId: "default" }]
}
]
});