polished_css/property/layout/
flex.rs

1crate::create_property!(
2    FlexBasis,
3    display = "",
4    atomic = "flex-b",
5    custom = false,
6    data_type = "<length-percentage>",
7    initial_value = Auto,
8    keywords = "auto,max-content,min-content,fit-content",
9);
10
11crate::create_property!(
12    FlexDirection,
13    display = "",
14    atomic = "flex-d",
15    custom = false,
16    data_type = "",
17    initial_value = Row,
18    keywords = "column,column-reverse,row,row-reverse",
19);
20
21// TODO: Add FlexFlow once there's an idea with tuples
22// crate::create_property!(
23//     FlexFlow,
24//     display = "",
25//     atomic = "flex-f",
26//     custom = false,
27//     data_type = "",
28//     initial_value = Initial,
29//     keywords = "",
30// );
31
32crate::create_property!(
33    FlexGrow,
34    display = "",
35    atomic = "flex-g",
36    custom = false,
37    data_type = "<number>",
38    initial_value = Initial,
39    keywords = "",
40);
41
42crate::create_property!(
43    FlexShrink,
44    display = "",
45    atomic = "flex-s",
46    custom = false,
47    data_type = "<number>",
48    initial_value = Initial,
49    keywords = "",
50);
51
52crate::create_property!(
53    FlexWrap,
54    display = "",
55    atomic = "flex-w",
56    custom = false,
57    data_type = "<number>",
58    initial_value = Initial,
59    keywords = "wrap,wrap-reverse,nowrap",
60);
61
62#[cfg(test)]
63mod test {
64    #[test]
65    fn flex_basis() {
66        let name = "flex-basis";
67        crate::test_property_initial_value!(FlexBasis, Auto);
68        crate::test_global_keywords!(FlexBasis, name);
69        crate::test_function_var!(FlexBasis, name);
70        #[cfg(feature = "atomic")]
71        crate::test_atomic_property!(FlexBasis, "flex-b");
72    }
73
74    #[test]
75    fn flex_direction() {
76        let name = "flex-direction";
77        crate::test_property_initial_value!(FlexDirection, Row);
78        crate::test_global_keywords!(FlexDirection, name);
79        crate::test_function_var!(FlexDirection, name);
80        #[cfg(feature = "atomic")]
81        crate::test_atomic_property!(FlexDirection, "flex-d");
82    }
83
84    #[test]
85    fn flex_grow() {
86        let name = "flex-grow";
87        crate::test_property_initial_value!(FlexGrow, Initial);
88        crate::test_global_keywords!(FlexGrow, name);
89        crate::test_function_var!(FlexGrow, name);
90        #[cfg(feature = "atomic")]
91        crate::test_atomic_property!(FlexGrow, "flex-g");
92    }
93
94    #[test]
95    fn flex_shrink() {
96        let name = "flex-shrink";
97        crate::test_property_initial_value!(FlexShrink, Initial);
98        crate::test_global_keywords!(FlexShrink, name);
99        crate::test_function_var!(FlexShrink, name);
100        #[cfg(feature = "atomic")]
101        crate::test_atomic_property!(FlexShrink, "flex-s");
102    }
103
104    #[test]
105    fn flex_wrap() {
106        let name = "flex-wrap";
107        crate::test_property_initial_value!(FlexWrap, Initial);
108        crate::test_global_keywords!(FlexWrap, name);
109        crate::test_function_var!(FlexWrap, name);
110        #[cfg(feature = "atomic")]
111        crate::test_atomic_property!(FlexWrap, "flex-w");
112    }
113}