add test for void html tag

This commit is contained in:
Josh Thomas 2024-12-13 00:48:24 -06:00
parent cff90ee869
commit 61b55641cb
2 changed files with 20 additions and 0 deletions

View file

@ -557,6 +557,15 @@ mod tests {
insta::assert_yaml_snapshot!(ast);
}
#[test]
fn test_parse_html_void() {
let source = r#"<img src="example.png" />"#;
let tokens = Lexer::new(source).tokenize().unwrap();
let mut parser = Parser::new(tokens);
let ast = parser.parse().unwrap();
insta::assert_yaml_snapshot!(ast);
}
#[test]
fn test_parse_script() {
let source = r#"<script type="text/javascript">

View file

@ -0,0 +1,11 @@
---
source: crates/djls-ast/src/parser.rs
expression: ast
---
nodes:
- Html:
Void:
tag_name: img
attributes:
src:
Value: example.png