From e6b44589e43cb5bda3764926aeb6541f8a42f522 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Mon, 25 Nov 2024 12:34:53 +0100 Subject: [PATCH] add failing test --- crates/oxide/src/parser.rs | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/crates/oxide/src/parser.rs b/crates/oxide/src/parser.rs index e1bc6510eda1..c3ea114ce679 100644 --- a/crates/oxide/src/parser.rs +++ b/crates/oxide/src/parser.rs @@ -1543,4 +1543,43 @@ mod test { let candidates = run(r#"
"#, false); assert_eq!(candidates, vec!["div", "class", "h2", "hz",]); } + + #[test] + fn classes_in_js_arrays_multi_line() { + let candidates = run( + "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]", + false, + ); + + assert_eq!( + candidates, + vec![ + "let", + "classes", + "bg-black", + "hover:px-0.5", + "text-[13px]", + "[--my-var:1_/_2]", + "--my-var:1_/_2", + "[.foo_&]:px-[0]", + "[.foo_&]:[color:red]", + ] + ); + + let candidates = run( + "\n \n ", + false, + ); + assert_eq!( + candidates, + vec![ + "script", + "const", + "classes", + "text-red-500", + "text-green-500", + "text-blue-500" + ] + ); + } }