Skip to main content

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#[node]
9#[derive(Parse, Peek, ToCursors, ToSpan, SemanticEq, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[cfg_attr(feature = "serde", derive(serde::Serialize))]
11#[cfg_attr(feature = "visitable", derive(csskit_derives::Visitable), visit(self))]
12#[derive(csskit_derives::NodeWithMetadata)]
13pub struct KeypressFunction {
14	#[atom(CssAtomSet::Keypress)]
15	pub name: T![Function],
16	pub params: T![String],
17	#[semantic_eq(skip)]
18	pub close: T![')'],
19}
20
21#[cfg(test)]
22mod tests {
23	use super::*;
24	use crate::CssAtomSet;
25	use css_parse::assert_parse;
26
27	#[test]
28	fn test_writes() {
29		assert_parse!(CssAtomSet::ATOMS, KeypressFunction, "keypress('a')");
30	}
31}