Skip to main content

css_ast/types/
counter_name.rs

1use super::prelude::*;
2
3/// <https://drafts.csswg.org/css-lists-3/#typedef-counter-name>
4///
5/// ```text,ignore
6/// <counter-name> = <custom-ident>
7/// ```
8#[derive(IntoCursor, Parse, Peek, ToCursors, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
9#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
10#[cfg_attr(feature = "visitable", derive(csskit_derives::Visitable), visit)]
11#[derive(csskit_derives::NodeWithMetadata)]
12pub struct CounterName(T![Ident]);
13
14#[cfg(test)]
15mod tests {
16	use super::*;
17	use crate::CssAtomSet;
18	use css_parse::{assert_parse, assert_parse_error};
19
20	#[test]
21	fn size_test() {
22		assert_eq!(std::mem::size_of::<CounterName>(), 12);
23	}
24
25	#[test]
26	fn test_parses() {
27		assert_parse!(CssAtomSet::ATOMS, CounterName, "my-counter");
28		assert_parse!(CssAtomSet::ATOMS, CounterName, "foo");
29	}
30
31	#[test]
32	fn test_errors() {
33		assert_parse_error!(CssAtomSet::ATOMS, CounterName, "");
34	}
35}