diff --git a/crates/rustmotion-html/src/element.rs b/crates/rustmotion-html/src/element.rs index 66db5c2..c308265 100644 --- a/crates/rustmotion-html/src/element.rs +++ b/crates/rustmotion-html/src/element.rs @@ -7,6 +7,16 @@ use crate::{element_attrs, tag_name, HtmlError}; enum TagKind { Container, Text, + /// Tags that never visually render in real HTML either (`
real
"#); + let children = v["children"].as_array().expect("children array"); + assert_eq!( + children.len(), + 1, + "script content must not become a component: {v}" + ); + assert_eq!(children[0]["content"], json!("real")); + } + + #[test] + fn title_and_noscript_and_template_elements_are_skipped_not_painted() { + let v = map_first( + r#"real
"#);
+ match e {
+ crate::HtmlError::UnsupportedNativeElement { tag, suggestion } => {
+ assert_eq!(tag, "img");
+ assert_eq!(suggestion, "rm-image");
+ }
+ other => panic!("expected UnsupportedNativeElement, got: {other:?}"),
+ }
+ }
+
+ #[test]
+ fn video_element_is_refused_with_rm_video_suggestion() {
+ let e = map_first_err(r#""#);
+ match e {
+ crate::HtmlError::UnsupportedNativeElement { tag, suggestion } => {
+ assert_eq!(tag, "video");
+ assert_eq!(suggestion, "rm-video");
+ }
+ other => panic!("expected UnsupportedNativeElement, got: {other:?}"),
+ }
+ }
+
+ #[test]
+ fn svg_element_is_refused_with_rm_svg_suggestion() {
+ let e = map_first_err(r#""#);
+ match e {
+ crate::HtmlError::UnsupportedNativeElement { tag, suggestion } => {
+ assert_eq!(tag, "svg");
+ assert_eq!(suggestion, "rm-svg");
+ }
+ other => panic!("expected UnsupportedNativeElement, got: {other:?}"),
+ }
+ }
+
+ // --- boolean attributes on custom elements (constat 4) ---
+
+ #[test]
+ fn custom_element_bool_attribute_true_and_false() {
+ let v = map_first(r#"