Skip to content

Commit a64180e

Browse files
committed
test(linter/no-fallthrough): add another test case with logical expr (#14832)
fixes #14828
1 parent b8f8ce5 commit a64180e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

crates/oxc_linter/src/rules/eslint/no_fallthrough.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,15 @@ fn test() {
588588
// Issue #6417: switch with logical operators should work correctly with break
589589
("switch(true) { case x === 1 || x === 2: a(); break; case x === 3: b(); }", None),
590590
("switch(true) { case x === 1 && y: a(); break; case x === 3: b(); }", None),
591+
(
592+
r#"c.map(c => { switch (true) {
593+
case c.f === 'qux' && xCount > 1: { return <td key="foo">Foo</td>; }
594+
case c.f === 'barbaz' && isFoo: { return <td key="bar">Foobar</td>; }
595+
case c.f === 'baz': { return arrayOfRecords.map(r => <td key={r.id}>{r.id}</td>); }
596+
default: { return <td>Bar</td>; }
597+
} });"#,
598+
None,
599+
),
591600
];
592601

593602
let fail = vec![

0 commit comments

Comments
 (0)