Escape HTML as we translate to rsx (#3038)
This commit is contained in:
1 parent
9ffd4b816b
commit
d64df87aba
4 files changed
+37
-1
No files matched your search
@@ -0,0 +1,18 @@
|
||||
use html_parser::Dom;
|
||||
|
||||
// Regression test for https://github.com/DioxusLabs/dioxus/issues/3037
|
||||
// We need to escape html entities as we translate html because rsx doesn't support them
|
||||
#[test]
|
||||
fn escaped_text() {
|
||||
let html = r#"<div><div>⌛⌛⌛⌛</div>"#.trim();
|
||||
|
||||
let dom = Dom::parse(html).unwrap();
|
||||
|
||||
let body = dioxus_rsx_rosetta::rsx_from_html(&dom);
|
||||
|
||||
let out = dioxus_autofmt::write_block_out(&body).unwrap();
|
||||
|
||||
let expected = r#"
|
||||
div { "<div>⌛⌛⌛⌛" }"#;
|
||||
pretty_assertions::assert_eq!(&out, &expected);
|
||||
}
|
||||
Reference in new issue
Block a user