mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-30 16:09:12 +00:00
34bdcd15cf
* create the dynamic value pool * assign ids to dynamic formatted segments * separate the rendering and literal pools * rsx output compiles again * more examples compiling with new rsx expansion * update template body explanation * all workspace examples compile * fix formatted segments in keys * start hot reload diffing * fix component literal hot reloading * start integrate new hot reloading with the CLI * simple hot reloads working * Fix hot reloading blocks with components * implement hot reloading for if chains * Fix hot reloading after a template requires a full rebuild * Fix hot reloading any attribute values * remove unsafe from hot reload utils * Fix hot reloading empty rsx * add more hot reloading tests * reorganize hot reload module * fix web hydration * fix empty rsx nodes in autoformatting * fix tests * remove path sorting logic from core * make template names more consistent in debug mode * fix quote_as_hot_reload_literal for explicitly typed literals * fix can_be_shorthand for string literals * fix formatted single dynamic expression * Fix usize component properties and playwright tests * remove default implementation for TemplateBody * add a bunch more comments for diffing, scoring and why this scoring system is optimal
31 lines
744 B
Rust
31 lines
744 B
Rust
use dioxus::prelude::*;
|
|
|
|
/// 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);
|
|
}
|