@@ -31,40 +31,40 @@ function generateTestCases(labelComponent: string, componentName: string) {
3131function generateTestCasesLabel ( labelComponent : string , componentName : string ) {
3232 return {
3333 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" />` ,
4141 `<><${ 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 } ></>`
4242 ] ,
4343 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+ }
6868 ]
6969 } ;
7070}
@@ -73,15 +73,14 @@ function generateAllTestCases() {
7373 const testSets : any [ ] = [ ] ;
7474
7575 // 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+ } ) ;
8181
8282 // Also generate test cases for each native DOM element
83- [ "Label" ] . forEach ( labels => {
84- // labelBasedComponents.forEach(labels => {
83+ labelBasedComponents . forEach ( labels => {
8584 testSets . push ( generateTestCasesLabel ( labels , components ) ) ;
8685 } ) ;
8786 } ) ;
0 commit comments