@@ -31,40 +31,40 @@ function generateTestCases(labelComponent: string, componentName: string) {
31
31
function generateTestCasesLabel ( labelComponent : string , componentName : string ) {
32
32
return {
33
33
valid : [
34
- // `<><${labelComponent} htmlFor="some-id">Some Label</${labelComponent}><${componentName} id="some-id"/></>`,
35
- // `<><${labelComponent} id="test-span">Some Label</${labelComponent}><${componentName} id="some-id" aria-labelledby="test-span"/></>`,
36
- // `<${labelComponent}>test</${labelComponent}>`,
37
- // `<${labelComponent}>test<${componentName} /></${labelComponent}>`,
38
- // `<${labelComponent}>test<SomeNesting><${componentName} /></SomeNesting></${labelComponent}>`,
39
- // `<Field label="this is my label"><${componentName} /></Field>`,
40
- // `<${componentName} aria-label="this is my component" />`,
34
+ `<><${ labelComponent } htmlFor="some-id">Some Label</${ labelComponent } ><${ componentName } id="some-id"/></>` ,
35
+ `<><${ labelComponent } id="test-span">Some Label</${ labelComponent } ><${ componentName } id="some-id" aria-labelledby="test-span"/></>` ,
36
+ `<${ labelComponent } >test</${ labelComponent } >` ,
37
+ `<${ labelComponent } >test<${ componentName } /></${ labelComponent } >` ,
38
+ `<${ labelComponent } >test<SomeNesting><${ componentName } /></SomeNesting></${ labelComponent } >` ,
39
+ `<Field label="this is my label"><${ componentName } /></Field>` ,
40
+ `<${ componentName } aria-label="this is my component" />` ,
41
41
`<><${ labelComponent } id="paragraph_label-2">type here</${ labelComponent } ><${ componentName } aria-labelledby="paragraph_label-2"></${ componentName } ><${ labelComponent } id="paragraph_label-3">type here</${ labelComponent } ><${ componentName } aria-labelledby="paragraph_label-3"></${ componentName } ></>`
42
42
] ,
43
43
invalid : [
44
- // {
45
- // code: `<><${componentName}/></>`,
46
- // errors: [{ messageId: "missingLabelOnInput" }]
47
- // },
48
- // {
49
- // code: `<><${labelComponent}/><${componentName}/></>`,
50
- // errors: [{ messageId: "missingLabelOnInput" }]
51
- // },
52
- // {
53
- // code: `<><${labelComponent} htmlFor="id"/><${componentName} /></>`,
54
- // errors: [{ messageId: "missingLabelOnInput" }]
55
- // },
56
- // {
57
- // code: `<${componentName} id="some-id"/>`,
58
- // errors: [{ messageId: "missingLabelOnInput" }]
59
- // },
60
- // {
61
- // code: `<><${labelComponent}>Some Label</${labelComponent}><${componentName} id="some-id"/></>`,
62
- // errors: [{ messageId: "missingLabelOnInput" }]
63
- // },
64
- // {
65
- // code: `<><Field></Field><${componentName} id="some-id"/></>`,
66
- // errors: [{ messageId: "missingLabelOnInput" }]
67
- // }
44
+ {
45
+ code : `<><${ componentName } /></>` ,
46
+ errors : [ { messageId : "missingLabelOnInput" } ]
47
+ } ,
48
+ {
49
+ code : `<><${ labelComponent } /><${ componentName } /></>` ,
50
+ errors : [ { messageId : "missingLabelOnInput" } ]
51
+ } ,
52
+ {
53
+ code : `<><${ labelComponent } htmlFor="id"/><${ componentName } /></>` ,
54
+ errors : [ { messageId : "missingLabelOnInput" } ]
55
+ } ,
56
+ {
57
+ code : `<${ componentName } id="some-id"/>` ,
58
+ errors : [ { messageId : "missingLabelOnInput" } ]
59
+ } ,
60
+ {
61
+ code : `<><${ labelComponent } >Some Label</${ labelComponent } ><${ componentName } id="some-id"/></>` ,
62
+ errors : [ { messageId : "missingLabelOnInput" } ]
63
+ } ,
64
+ {
65
+ code : `<><Field></Field><${ componentName } id="some-id"/></>` ,
66
+ errors : [ { messageId : "missingLabelOnInput" } ]
67
+ }
68
68
]
69
69
} ;
70
70
}
@@ -73,15 +73,14 @@ function generateAllTestCases() {
73
73
const testSets : any [ ] = [ ] ;
74
74
75
75
// For each input-based component, generate test cases
76
- [ "Input" ] . forEach ( components => {
77
- // applicableComponents.forEach(components => {
78
- // elementsUsedAsLabels.forEach(labels => {
79
- // testSets.push(generateTestCases(labels, components));
80
- // });
76
+
77
+ applicableComponents . forEach ( components => {
78
+ elementsUsedAsLabels . forEach ( labels => {
79
+ testSets . push ( generateTestCases ( labels , components ) ) ;
80
+ } ) ;
81
81
82
82
// Also generate test cases for each native DOM element
83
- [ "Label" ] . forEach ( labels => {
84
- // labelBasedComponents.forEach(labels => {
83
+ labelBasedComponents . forEach ( labels => {
85
84
testSets . push ( generateTestCasesLabel ( labels , components ) ) ;
86
85
} ) ;
87
86
} ) ;
0 commit comments