css_ast/functions/
keypress_function.rs

1use super::prelude::*;
2
3/// <https://drafts.csswg.org/css-grid-2/#funcdef-grid-template-columns-fit-content>
4///
5/// ```text
6/// keypress( <string> )
7/// ```
8#[derive(Parse, Peek, ToCursors, ToSpan, SemanticEq, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
9#[cfg_attr(feature = "serde", derive(serde::Serialize))]
10#[cfg_attr(feature = "visitable", derive(csskit_derives::Visitable), visit(self))]
11pub struct KeypressFunction {
12	#[atom(CssAtomSet::Keypress)]
13	pub name: T![Function],
14	pub params: T![String],
15	pub close: T![')'],
16}
17
18#[cfg(test)]
19mod tests {
20	use super::*;
21	use crate::CssAtomSet;
22	use css_parse::assert_parse;
23
24	#[test]
25	fn size_test() {
26		assert_eq!(std::mem::size_of::<KeypressFunction>(), 36);
27	}
28
29	#[test]
30	fn test_writes() {
31		assert_parse!(CssAtomSet::ATOMS, KeypressFunction, "keypress('a')");
32	}
33}