Skip to content

Commit 228b644

Browse files
committed
test: add broken test case for jsx-key rule
1 parent 422ff33 commit 228b644

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/lib/rules/jsx-key.js

+22
Original file line numberDiff line numberDiff line change
@@ -387,5 +387,27 @@ ruleTester.run('jsx-key', rule, {
387387
{ messageId: 'missingIterKey' },
388388
],
389389
},
390+
{
391+
code: `
392+
const TestCase = () => {
393+
const list = [1, 2, 3, 4, 5];
394+
395+
return (
396+
<div>
397+
{list.map(item => {
398+
if (item < 2) return <div>{item}</div>;
399+
else if (item < 5) return <div />;
400+
else return <div />;
401+
})}
402+
</div>
403+
);
404+
};
405+
`,
406+
errors: [
407+
{ messageId: 'missingIterKey' },
408+
{ messageId: 'missingIterKey' },
409+
{ messageId: 'missingIterKey' },
410+
],
411+
},
390412
]),
391413
});

0 commit comments

Comments
 (0)