Skip to content

Commit 3ad60c4

Browse files
authored
Merge pull request #75 from dev-five-git/postfix-kebab-issue
Convert postfix to kebab
2 parents eca7001 + 570fa4c commit 3ad60c4

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.changeset/slimy-apes-help.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/wasm": patch
3+
---
4+
5+
Postfix convert to kebab

libs/css/src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl From<&str> for StyleSelector {
6767
&s[1..]
6868
))
6969
} else {
70-
Postfix(value.to_string())
70+
Postfix(to_kebab_case(value))
7171
}
7272
}
7373
}
@@ -564,10 +564,18 @@ mod tests {
564564
#[test]
565565
fn test_style_selector() {
566566
assert_eq!(StyleSelector::from("hover"), Postfix("hover".to_string()));
567+
assert_eq!(
568+
StyleSelector::from("focusVisible"),
569+
Postfix("focus-visible".to_string())
570+
);
567571
assert_eq!(
568572
StyleSelector::from("groupHover"),
569573
Dual("*[role=group]".to_string(), "hover".to_string())
570574
);
575+
assert_eq!(
576+
StyleSelector::from("groupFocusVisible"),
577+
Dual("*[role=group]".to_string(), "focus-visible".to_string())
578+
);
571579
assert_eq!(
572580
StyleSelector::from("group1"),
573581
Dual("*[role=group]".to_string(), "1".to_string())

libs/sheet/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ mod tests {
231231
sheet.add_property("test", "background-color", 1, "red", None, false);
232232
sheet.add_property("test", "background", 1, "some", None, false);
233233
assert_debug_snapshot!(sheet.create_css());
234+
//
235+
// let mut sheet = StyleSheet::default();
236+
// sheet.add_property("test", "background-color", 1, "red", Some(&StyleSelector::Postfix("hover".to_string())), false);
237+
// sheet.add_property("test", "background", 1, "some", Some(&StyleSelector::Postfix("focus".to_string())), false);
238+
// assert_debug_snapshot!(sheet.create_css());
234239
}
235240
#[test]
236241
fn test_create_css_with_basic_sort_test() {

0 commit comments

Comments
 (0)