Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions libs/css/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 6 additions & 0 deletions libs/extractor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
22 changes: 4 additions & 18 deletions libs/sheet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Import from bun-test-env-dom to enable DOM environment
import 'bun-test-env-dom'

import {
afterAll,
afterEach,
Expand Down