Skip to main content

css_ast/types/
display_box.rs

1use super::prelude::*;
2
3/// <https://drafts.csswg.org/css-display-4/#typedef-display-box>
4///
5/// ```text,ignore
6/// <display-box> = contents | none
7/// ```
8#[derive(
9	Parse, Peek, IntoCursor, ToSpan, SemanticEq, ToCursors, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
10)]
11#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
12#[cfg_attr(feature = "visitable", derive(csskit_derives::Visitable), visit(skip))]
13pub enum DisplayBox {
14	#[atom(CssAtomSet::Contents)]
15	Contents(T![Ident]),
16	#[atom(CssAtomSet::None)]
17	None(T![Ident]),
18}
19
20#[cfg(test)]
21mod tests {
22	use super::*;
23	use crate::CssAtomSet;
24	use css_parse::{assert_parse, assert_peek_false};
25
26	#[test]
27	fn size_test() {
28		assert_eq!(std::mem::size_of::<DisplayBox>(), 16);
29	}
30
31	#[test]
32	fn test_writes() {
33		assert_parse!(CssAtomSet::ATOMS, DisplayBox, "contents");
34		assert_parse!(CssAtomSet::ATOMS, DisplayBox, "none");
35	}
36
37	#[test]
38	fn test_errors() {
39		assert_peek_false!(CssAtomSet::ATOMS, DisplayBox, "foo");
40	}
41}