Skip to content

Commit

Permalink
test(tsx.rs): add tsx_component_with_string_prop() test to see how …
Browse files Browse the repository at this point in the history
…the jsx strings are parsed

see getgrit#552
  • Loading branch information
Alex-ley-scrub committed Nov 17, 2024
1 parent 2c23428 commit fffd6ae
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crates/language/src/tsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,4 +454,20 @@ mod tests {
println!("{:#?}", nodes);
assert!(!nodes.is_empty());
}

#[test]
fn tsx_component_with_string_prop() {
let snippet =
r#"return (<OtherComponent value="users_import">Hello World</OtherComponent>);"#;
let lang = Tsx::new(None);
let mut parser = tree_sitter::Parser::new().unwrap();
parser.set_language(lang.get_ts_language()).unwrap();
let snippets = lang.parse_snippet_contexts(snippet);
let nodes = nodes_from_indices(&snippets);
println!("{:#?}", nodes);
nodes.iter().for_each(|n| {
n.print_node_tree();
});
assert!(!nodes.is_empty());
}
}

0 comments on commit fffd6ae

Please sign in to comment.