Skip to content

Commit 6c9da55

Browse files
committed
Add testcase
1 parent 449cff1 commit 6c9da55

1 file changed

Lines changed: 10 additions & 44 deletions

File tree

libs/extractor/src/tailwind.rs

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,34 +2530,11 @@ fn parse_border_utility(class: &str) -> Option<(String, String)> {
25302530
}
25312531
}
25322532

2533-
// Border without prefix
2533+
// Standalone "rounded" (without suffix) - note: "rounded-*" variants are handled
2534+
// via BORDER_RADIUS_SCALE lookup above in the strip_prefix("rounded-") branch
25342535
if class == "rounded" {
25352536
return Some(("border-radius".to_string(), "0.25rem".to_string()));
25362537
}
2537-
if class == "rounded-none" {
2538-
return Some(("border-radius".to_string(), "0px".to_string()));
2539-
}
2540-
if class == "rounded-sm" {
2541-
return Some(("border-radius".to_string(), "0.125rem".to_string()));
2542-
}
2543-
if class == "rounded-md" {
2544-
return Some(("border-radius".to_string(), "0.375rem".to_string()));
2545-
}
2546-
if class == "rounded-lg" {
2547-
return Some(("border-radius".to_string(), "0.5rem".to_string()));
2548-
}
2549-
if class == "rounded-xl" {
2550-
return Some(("border-radius".to_string(), "0.75rem".to_string()));
2551-
}
2552-
if class == "rounded-2xl" {
2553-
return Some(("border-radius".to_string(), "1rem".to_string()));
2554-
}
2555-
if class == "rounded-3xl" {
2556-
return Some(("border-radius".to_string(), "1.5rem".to_string()));
2557-
}
2558-
if class == "rounded-full" {
2559-
return Some(("border-radius".to_string(), "9999px".to_string()));
2560-
}
25612538

25622539
// Border width
25632540
if let Some(rest) = class.strip_prefix("border-") {
@@ -2623,22 +2600,11 @@ fn parse_border_utility(class: &str) -> Option<(String, String)> {
26232600
}
26242601
}
26252602

2626-
// Border without suffix (default 1px)
2603+
// Standalone "border" (without suffix) - note: "border-0/2/4/8" variants are handled
2604+
// via BORDER_WIDTH_SCALE lookup above in the strip_prefix("border-") branch
26272605
if class == "border" {
26282606
return Some(("border-width".to_string(), "1px".to_string()));
26292607
}
2630-
if class == "border-0" {
2631-
return Some(("border-width".to_string(), "0px".to_string()));
2632-
}
2633-
if class == "border-2" {
2634-
return Some(("border-width".to_string(), "2px".to_string()));
2635-
}
2636-
if class == "border-4" {
2637-
return Some(("border-width".to_string(), "4px".to_string()));
2638-
}
2639-
if class == "border-8" {
2640-
return Some(("border-width".to_string(), "8px".to_string()));
2641-
}
26422608

26432609
// Outline
26442610
if let Some(rest) = class.strip_prefix("outline-") {
@@ -5398,7 +5364,7 @@ mod tests {
53985364
assert!(result.is_none());
53995365
}
54005366

5401-
// Wave 6.11: Individual rounded variants (lines 2130-2151)
5367+
// Wave 6.11: Individual rounded variants (via BORDER_RADIUS_SCALE lookup)
54025368
#[rstest]
54035369
#[case("rounded-none", "border-radius", "0px")]
54045370
#[case("rounded-sm", "border-radius", "0.125rem")]
@@ -5418,7 +5384,7 @@ mod tests {
54185384
assert_eq!(parsed.value, expected_value);
54195385
}
54205386

5421-
// Wave 6.12: Border collapse/separate and border-0/2/4/8 (lines 2211-2232)
5387+
// Wave 6.12: Border collapse/separate (border-0/2/4/8 handled via BORDER_WIDTH_SCALE)
54225388
#[rstest]
54235389
#[case("border-collapse", "border-collapse", "collapse")]
54245390
#[case("border-separate", "border-collapse", "separate")]
@@ -5798,7 +5764,7 @@ mod tests {
57985764
assert!(result.is_none());
57995765
}
58005766

5801-
// Wave 7.5: Individual rounded variants via full parsing path (lines 2130-2151)
5767+
// Wave 7.5: Individual rounded variants via BORDER_RADIUS_SCALE lookup
58025768
#[rstest]
58035769
#[case("rounded", "border-radius", "0.25rem")]
58045770
#[case("rounded-none", "border-radius", "0px")]
@@ -5819,7 +5785,7 @@ mod tests {
58195785
assert_eq!(parsed.value, expected_value);
58205786
}
58215787

5822-
// Wave 7.6: border-0/2/4/8 standalone via full parsing path (lines 2223-2232)
5788+
// Wave 7.6: border-0/2/4/8 via BORDER_WIDTH_SCALE lookup
58235789
#[rstest]
58245790
#[case("border", "border-width", "1px")]
58255791
#[case("border-0", "border-width", "0px")]
@@ -5961,7 +5927,7 @@ mod tests {
59615927
assert!(is_likely_tailwind_class(class));
59625928
}
59635929

5964-
// Wave 8.3: parse_tailwind_to_styles integration for rounded variants (lines 2130-2151)
5930+
// Wave 8.3: parse_tailwind_to_styles integration for rounded variants (via BORDER_RADIUS_SCALE)
59655931
#[test]
59665932
#[serial]
59675933
fn test_parse_tailwind_to_styles_rounded_integration() {
@@ -5975,7 +5941,7 @@ mod tests {
59755941
assert_eq!(styles.len(), 8);
59765942
}
59775943

5978-
// Wave 8.4: parse_tailwind_to_styles integration for border widths (lines 2223-2232)
5944+
// Wave 8.4: parse_tailwind_to_styles integration for border widths (via BORDER_WIDTH_SCALE)
59795945
#[test]
59805946
#[serial]
59815947
fn test_parse_tailwind_to_styles_border_width_integration() {

0 commit comments

Comments
 (0)