Skip to main content

css_ast/types/
fixed_breadth.rs

1use crate::{CalcableValue, LengthPercentage, NonNegative};
2
3/// <https://drafts.csswg.org/css-grid-2/#typedef-fixed-breadth>
4///
5/// ```text,ignore
6/// <fixed-breadth> = <length-percentage [0,∞]>
7/// ```
8pub type FixedBreadth<'a> = CalcableValue<'a, NonNegative<LengthPercentage>>;
9
10#[cfg(test)]
11mod tests {
12	use super::*;
13	use crate::CssAtomSet;
14	use css_parse::assert_parse;
15
16	#[test]
17	fn test_writes() {
18		assert_parse!(CssAtomSet::ATOMS, FixedBreadth, "10px");
19		assert_parse!(CssAtomSet::ATOMS, FixedBreadth, "50%");
20		assert_parse!(CssAtomSet::ATOMS, FixedBreadth, "calc(10px + 2%)");
21		assert_parse!(CssAtomSet::ATOMS, FixedBreadth, "var(--x)");
22	}
23}