diff --git a/.changeset/slimy-apes-help.md b/.changeset/slimy-apes-help.md new file mode 100644 index 00000000..4bcce24f --- /dev/null +++ b/.changeset/slimy-apes-help.md @@ -0,0 +1,5 @@ +--- +"@devup-ui/wasm": patch +--- + +Postfix convert to kebab diff --git a/libs/css/src/lib.rs b/libs/css/src/lib.rs index 199df6a7..04387686 100644 --- a/libs/css/src/lib.rs +++ b/libs/css/src/lib.rs @@ -67,7 +67,7 @@ impl From<&str> for StyleSelector { &s[1..] )) } else { - Postfix(value.to_string()) + Postfix(to_kebab_case(value)) } } } @@ -564,10 +564,18 @@ mod tests { #[test] fn test_style_selector() { assert_eq!(StyleSelector::from("hover"), Postfix("hover".to_string())); + assert_eq!( + StyleSelector::from("focusVisible"), + Postfix("focus-visible".to_string()) + ); assert_eq!( StyleSelector::from("groupHover"), Dual("*[role=group]".to_string(), "hover".to_string()) ); + assert_eq!( + StyleSelector::from("groupFocusVisible"), + Dual("*[role=group]".to_string(), "focus-visible".to_string()) + ); assert_eq!( StyleSelector::from("group1"), Dual("*[role=group]".to_string(), "1".to_string()) diff --git a/libs/sheet/src/lib.rs b/libs/sheet/src/lib.rs index c7decf95..ca88ef6d 100644 --- a/libs/sheet/src/lib.rs +++ b/libs/sheet/src/lib.rs @@ -231,6 +231,11 @@ mod tests { sheet.add_property("test", "background-color", 1, "red", None, false); sheet.add_property("test", "background", 1, "some", None, false); assert_debug_snapshot!(sheet.create_css()); + // + // let mut sheet = StyleSheet::default(); + // sheet.add_property("test", "background-color", 1, "red", Some(&StyleSelector::Postfix("hover".to_string())), false); + // sheet.add_property("test", "background", 1, "some", Some(&StyleSelector::Postfix("focus".to_string())), false); + // assert_debug_snapshot!(sheet.create_css()); } #[test] fn test_create_css_with_basic_sort_test() {