Skip to content

Commit

Permalink
(ast/values) implement flex-basis property
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus committed Nov 9, 2024
1 parent d27f87b commit f306dd8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
27 changes: 27 additions & 0 deletions crates/hdx_ast/src/css/values/flexbox/impls.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
pub(crate) use crate::traits::StyleValue;
pub(crate) use hdx_proc_macro::*;

#[cfg(test)]
mod tests {
use super::super::*;
use crate::test_helpers::*;

#[test]
fn size_test() {
assert_size!(FlexDirection, 1);
assert_size!(FlexWrap, 1);
assert_size!(FlexFlow, 2);
// assert_size!(Flex, 1);
assert_size!(FlexGrow, 4);
assert_size!(FlexShrink, 4);
assert_size!(FlexBasis, 12);
assert_size!(JustifyContent, 1);
assert_size!(AlignItems, 1);
assert_size!(AlignSelf, 1);
assert_size!(AlignContent, 1);
}

#[test]
fn test_writes() {
assert_parse!(FlexBasis, "auto");
assert_parse!(FlexBasis, "4px");
}
}
18 changes: 9 additions & 9 deletions crates/hdx_ast/src/css/values/flexbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ pub struct FlexGrow;
#[animation_type("number")]
pub struct FlexShrink;

// // https://drafts.csswg.org/css-flexbox-1/#flex-basis
// #[value(" content | <'width'> ")]
// #[initial("auto")]
// #[applies_to("flex items")]
// #[inherited("no")]
// #[percentages("relative to the flex container’s inner main size")]
// #[canonical_order("per grammar")]
// #[animation_type("by computed value type")]
// pub enum FlexBasis {}
// https://drafts.csswg.org/css-flexbox-1/#flex-basis
#[value(" content | <'width'> ")]
#[initial("auto")]
#[applies_to("flex items")]
#[inherited("no")]
#[percentages("relative to the flex container’s inner main size")]
#[canonical_order("per grammar")]
#[animation_type("by computed value type")]
pub enum FlexBasis {}

// https://drafts.csswg.org/css-flexbox-1/#justify-content
#[value(" flex-start | flex-end | center | space-between | space-around ")]
Expand Down
1 change: 1 addition & 0 deletions crates/hdx_ast/src/css/values/flexbox/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub(crate) use crate::css::units::CSSFloat;
pub(crate) use crate::css::values::sizing::Width;

// Re-expose stylevalues for shorthands
pub(crate) use super::{FlexDirection, FlexWrap};

0 comments on commit f306dd8

Please sign in to comment.