Skip to main content

css_ast/types/
fixed_repeat.rs

1use crate::{FixedSize, NamedRepeatItems, RepeatFunction};
2
3/// <https://drafts.csswg.org/css-grid-2/#typedef-fixed-repeat>
4///
5/// ```text,ignore
6/// <fixed-repeat> = repeat( [ <integer [1,∞]> ] , [ <line-names>? <fixed-size> ]+ <line-names>? )
7/// ```
8pub type FixedRepeat<'a> = RepeatFunction<NamedRepeatItems<'a, FixedSize<'a>>>;
9
10#[cfg(test)]
11mod tests {
12	use super::*;
13	use crate::CssAtomSet;
14	use css_parse::{assert_parse, assert_parse_error};
15
16	#[test]
17	fn test_writes() {
18		assert_parse!(CssAtomSet::ATOMS, FixedRepeat, "repeat(2,10px)");
19		assert_parse!(CssAtomSet::ATOMS, FixedRepeat, "repeat(3,[a] 10px)");
20		assert_parse!(CssAtomSet::ATOMS, FixedRepeat, "repeat(3,10px [a])");
21	}
22
23	#[test]
24	fn test_errors() {
25		assert_parse_error!(CssAtomSet::ATOMS, FixedRepeat, "repeat(2,)");
26		assert_parse_error!(CssAtomSet::ATOMS, FixedRepeat, "repeat(2,1fr)");
27	}
28}