Skip to content

Commit e6b4458

Browse files
committed
add failing test
1 parent 37ec6a8 commit e6b4458

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

crates/oxide/src/parser.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,4 +1543,43 @@ mod test {
15431543
let candidates = run(r#"<div class="h2 hz"></div>"#, false);
15441544
assert_eq!(candidates, vec!["div", "class", "h2", "hz",]);
15451545
}
1546+
1547+
#[test]
1548+
fn classes_in_js_arrays_multi_line() {
1549+
let candidates = run(
1550+
"let classes = [\n\t'bg-black',\n\t'hover:px-0.5',\n\t'text-[13px]',\n\t'[--my-var:1_/_2]',\n\t'[.foo_&]:px-[0]',\n\t'[.foo_&]:[color:red]'\n]",
1551+
false,
1552+
);
1553+
1554+
assert_eq!(
1555+
candidates,
1556+
vec![
1557+
"let",
1558+
"classes",
1559+
"bg-black",
1560+
"hover:px-0.5",
1561+
"text-[13px]",
1562+
"[--my-var:1_/_2]",
1563+
"--my-var:1_/_2",
1564+
"[.foo_&]:px-[0]",
1565+
"[.foo_&]:[color:red]",
1566+
]
1567+
);
1568+
1569+
let candidates = run(
1570+
"\n <script>\n const classes = [\n 'text-red-500',\n 'text-green-500',\n 'text-blue-500',\n ]\n </script>\n ",
1571+
false,
1572+
);
1573+
assert_eq!(
1574+
candidates,
1575+
vec![
1576+
"script",
1577+
"const",
1578+
"classes",
1579+
"text-red-500",
1580+
"text-green-500",
1581+
"text-blue-500"
1582+
]
1583+
);
1584+
}
15461585
}

0 commit comments

Comments
 (0)