* clear away prelude on dioxus * clippy * wip - drop prelude from dioxus-html * docs clippy * wip * more fixe * delete all preludes * doc... * better export * merge some imports * fewer global imports * global incremental renderer * fix cargo doc
33 lines
775 B
Rust
33 lines
775 B
Rust
use dioxus::prelude::*;
|
|
use dioxus_core::TemplateNode;
|
|
|
|
/// Make sure that rsx! is parsing templates and their attributes properly
|
|
#[test]
|
|
fn attributes_pass_properly() {
|
|
let h = rsx! {
|
|
circle {
|
|
cx: 50,
|
|
cy: 50,
|
|
r: 40,
|
|
stroke: "green",
|
|
fill: "yellow"
|
|
}
|
|
};
|
|
|
|
let o = h.unwrap();
|
|
|
|
let template = &o.template;
|
|
|
|
assert_eq!(template.attr_paths.len(), 3);
|
|
|
|
let _circle = template.roots[0];
|
|
let TemplateNode::Element { attrs, tag, namespace, children } = _circle else {
|
|
panic!("Expected an element");
|
|
};
|
|
|
|
assert_eq!(tag, "circle");
|
|
assert_eq!(namespace, Some("http://www.w3.org/2000/svg"));
|
|
assert_eq!(children.len(), 0);
|
|
assert_eq!(attrs.len(), 5);
|
|
}
|