@@ -5,6 +5,56 @@ import rule, { RULE_NAME } from "./no-missing-button-type";
55
66ruleTester . run ( RULE_NAME , rule , {
77 invalid : [
8+ {
9+ code : tsx `<button />;` ,
10+ errors : [
11+ {
12+ messageId : "noMissingButtonType" ,
13+ suggestions : [
14+ {
15+ messageId : "addButtonType" ,
16+ data : { type : "button" } ,
17+ output : tsx `<button type="button" />;` ,
18+ } ,
19+ {
20+ messageId : "addButtonType" ,
21+ data : { type : "submit" } ,
22+ output : tsx `<button type="submit" />;` ,
23+ } ,
24+ {
25+ messageId : "addButtonType" ,
26+ data : { type : "reset" } ,
27+ output : tsx `<button type="reset" />;` ,
28+ } ,
29+ ] ,
30+ } ,
31+ ] ,
32+ } ,
33+ {
34+ code : tsx `<button type />;` ,
35+ errors : [
36+ {
37+ messageId : "noMissingButtonType" ,
38+ suggestions : [
39+ {
40+ messageId : "addButtonType" ,
41+ data : { type : "button" } ,
42+ output : tsx `<button type="button" />;` ,
43+ } ,
44+ {
45+ messageId : "addButtonType" ,
46+ data : { type : "submit" } ,
47+ output : tsx `<button type="submit" />;` ,
48+ } ,
49+ {
50+ messageId : "addButtonType" ,
51+ data : { type : "reset" } ,
52+ output : tsx `<button type="reset" />;` ,
53+ } ,
54+ ] ,
55+ } ,
56+ ] ,
57+ } ,
858 {
959 code : tsx `<button>Click me</button>;` ,
1060 errors : [
@@ -39,17 +89,17 @@ ruleTester.run(RULE_NAME, rule, {
3989 {
4090 messageId : "addButtonType" ,
4191 data : { type : "button" } ,
42- output : tsx `<PolyComponent as ="button" type ="button">Click me</PolyComponent>;` ,
92+ output : tsx `<PolyComponent type ="button" as ="button">Click me</PolyComponent>;` ,
4393 } ,
4494 {
4595 messageId : "addButtonType" ,
4696 data : { type : "submit" } ,
47- output : tsx `<PolyComponent as="button" type="submit ">Click me</PolyComponent>;` ,
97+ output : tsx `<PolyComponent type="submit" as="button ">Click me</PolyComponent>;` ,
4898 } ,
4999 {
50100 messageId : "addButtonType" ,
51101 data : { type : "reset" } ,
52- output : tsx `<PolyComponent as="button" type="reset ">Click me</PolyComponent>;` ,
102+ output : tsx `<PolyComponent type="reset" as="button ">Click me</PolyComponent>;` ,
53103 } ,
54104 ] ,
55105 } ,
0 commit comments