Skip to content

Commit ac7cd19

Browse files
committed
Increase coverage
1 parent 0377f63 commit ac7cd19

4 files changed

Lines changed: 33 additions & 18 deletions

File tree

libs/css/src/lib.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,26 @@ mod tests {
353353
#[case("with-dash", "with-dash")]
354354
#[case("with_underscore", "with_underscore")]
355355
#[case("CamelCase123", "CamelCase123")]
356+
// Additional cases for full coverage of special characters
357+
#[case("<", "_lt_")]
358+
#[case("*", "_st_")]
359+
#[case(",", "_cm_")]
360+
#[case("'", "_sq_")]
361+
#[case("/", "_sl_")]
362+
#[case("\\", "_bs_")]
363+
#[case("%", "_pc_")]
364+
#[case("^", "_cr_")]
365+
#[case("$", "_dl_")]
366+
#[case("|", "_pp_")]
367+
#[case("@", "_at_")]
368+
#[case("!", "_ex_")]
369+
#[case("?", "_qm_")]
370+
#[case(";", "_sc_")]
371+
#[case("{", "_lc_")]
372+
#[case("}", "_rc_")]
373+
// Unicode character (non-ASCII)
374+
#[case("한글", "_ud55c__uae00_")]
375+
#[case("emoji😀", "emoji_u1f600_")]
356376
fn test_encode_selector(#[case] input: &str, #[case] expected: &str) {
357377
assert_eq!(encode_selector(input), expected);
358378
}

libs/extractor/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9422,6 +9422,12 @@ globalCss({
94229422
"@devup-ui/react",
94239423
true
94249424
)] // .jsx
9425+
#[case(
9426+
"test.unknown",
9427+
"import { Box } from '@devup-ui/react';",
9428+
"@devup-ui/react",
9429+
false
9430+
)] // unsupported file extension
94259431
fn test_has_devup_ui(
94269432
#[case] filename: &str,
94279433
#[case] code: &str,

libs/sheet/src/lib.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -521,33 +521,19 @@ impl StyleSheet {
521521
match kind {
522522
AtRuleKind::Media => {
523523
// Combine @media queries with 'and'
524-
format!(
525-
"@media(min-width:{break_point}px)and {query}{{{inner_css}}}"
526-
)
524+
format!("@media(min-width:{break_point}px)and {query}{{{inner_css}}}")
527525
}
528526
AtRuleKind::Supports => {
529527
// Nest @supports inside @media for breakpoint
530-
format!(
531-
"@media(min-width:{break_point}px){{@supports{query}{{{inner_css}}}}}"
532-
)
528+
format!("@media(min-width:{break_point}px){{@supports{query}{{{inner_css}}}}}")
533529
}
534530
AtRuleKind::Container => {
535531
// Nest @container inside @media for breakpoint
536-
format!(
537-
"@media(min-width:{break_point}px){{@container{query}{{{inner_css}}}}}"
538-
)
532+
format!("@media(min-width:{break_point}px){{@container{query}{{{inner_css}}}}}")
539533
}
540534
}
541535
} else {
542-
format!(
543-
"@{kind}{}{{{}}}",
544-
if query.starts_with("(") {
545-
query.clone()
546-
} else {
547-
format!(" {query}")
548-
},
549-
inner_css.as_str()
550-
)
536+
format!("@{kind}{}{{{}}}", if query.starts_with("(") { query.clone() } else { format!(" {query}") }, inner_css.as_str())
551537
}
552538
.as_str(),
553539
);

packages/react/src/stores/__tests__/theme-store.test.ts renamed to packages/react/src/stores/__tests__/theme-store.browser.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Import from bun-test-env-dom to enable DOM environment
2+
import 'bun-test-env-dom'
3+
14
import {
25
afterAll,
36
afterEach,

0 commit comments

Comments
 (0)