Skip to content

Commit

Permalink
[Tests] button-has-type: add passing test
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 26, 2023
1 parent 14e315a commit 373167c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/lib/rules/button-has-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,31 @@ ruleTester.run('button-has-type', rule, {
},
},
},
{
code: `
function MyComponent(): ReactElement {
const buttonProps: (Required<Attributes> & ButtonHTMLAttributes<HTMLButtonElement>)[] = [
{
children: 'test',
key: 'test',
onClick: (): void => {
return;
},
},
];
return <>
{
buttonProps.map(
({ key, ...props }: Required<Attributes> & ButtonHTMLAttributes<HTMLButtonElement>): ReactElement =>
<button key={key} type="button" {...props} />
)
}
</>;
}
`,
features: ['fragment', 'types'],
},
]),
invalid: parsers.all([
{
Expand Down

0 comments on commit 373167c

Please sign in to comment.