diff --git a/libs/css/src/lib.rs b/libs/css/src/lib.rs index 740a3e52..456cd4bd 100644 --- a/libs/css/src/lib.rs +++ b/libs/css/src/lib.rs @@ -353,6 +353,26 @@ mod tests { #[case("with-dash", "with-dash")] #[case("with_underscore", "with_underscore")] #[case("CamelCase123", "CamelCase123")] + // Additional cases for full coverage of special characters + #[case("<", "_lt_")] + #[case("*", "_st_")] + #[case(",", "_cm_")] + #[case("'", "_sq_")] + #[case("/", "_sl_")] + #[case("\\", "_bs_")] + #[case("%", "_pc_")] + #[case("^", "_cr_")] + #[case("$", "_dl_")] + #[case("|", "_pp_")] + #[case("@", "_at_")] + #[case("!", "_ex_")] + #[case("?", "_qm_")] + #[case(";", "_sc_")] + #[case("{", "_lc_")] + #[case("}", "_rc_")] + // Unicode character (non-ASCII) + #[case("한글", "_ud55c__uae00_")] + #[case("emoji😀", "emoji_u1f600_")] fn test_encode_selector(#[case] input: &str, #[case] expected: &str) { assert_eq!(encode_selector(input), expected); } diff --git a/libs/extractor/src/lib.rs b/libs/extractor/src/lib.rs index d24faa7f..daec4d15 100644 --- a/libs/extractor/src/lib.rs +++ b/libs/extractor/src/lib.rs @@ -9422,6 +9422,12 @@ globalCss({ "@devup-ui/react", true )] // .jsx + #[case( + "test.unknown", + "import { Box } from '@devup-ui/react';", + "@devup-ui/react", + false + )] // unsupported file extension fn test_has_devup_ui( #[case] filename: &str, #[case] code: &str, diff --git a/libs/sheet/src/lib.rs b/libs/sheet/src/lib.rs index 41942e0b..86124fa3 100644 --- a/libs/sheet/src/lib.rs +++ b/libs/sheet/src/lib.rs @@ -521,33 +521,19 @@ impl StyleSheet { match kind { AtRuleKind::Media => { // Combine @media queries with 'and' - format!( - "@media(min-width:{break_point}px)and {query}{{{inner_css}}}" - ) + format!("@media(min-width:{break_point}px)and {query}{{{inner_css}}}") } AtRuleKind::Supports => { // Nest @supports inside @media for breakpoint - format!( - "@media(min-width:{break_point}px){{@supports{query}{{{inner_css}}}}}" - ) + format!("@media(min-width:{break_point}px){{@supports{query}{{{inner_css}}}}}") } AtRuleKind::Container => { // Nest @container inside @media for breakpoint - format!( - "@media(min-width:{break_point}px){{@container{query}{{{inner_css}}}}}" - ) + format!("@media(min-width:{break_point}px){{@container{query}{{{inner_css}}}}}") } } } else { - format!( - "@{kind}{}{{{}}}", - if query.starts_with("(") { - query.clone() - } else { - format!(" {query}") - }, - inner_css.as_str() - ) + format!("@{kind}{}{{{}}}", if query.starts_with("(") { query.clone() } else { format!(" {query}") }, inner_css.as_str()) } .as_str(), ); diff --git a/packages/react/src/stores/__tests__/theme-store.test.ts b/packages/react/src/stores/__tests__/theme-store.browser.test.ts similarity index 97% rename from packages/react/src/stores/__tests__/theme-store.test.ts rename to packages/react/src/stores/__tests__/theme-store.browser.test.ts index 5c02f491..b96d5f58 100644 --- a/packages/react/src/stores/__tests__/theme-store.test.ts +++ b/packages/react/src/stores/__tests__/theme-store.browser.test.ts @@ -1,3 +1,6 @@ +// Import from bun-test-env-dom to enable DOM environment +import 'bun-test-env-dom' + import { afterAll, afterEach,