use std::collections::HashMap; use wal_core::{ component::callback::Callback, events::{onclick, EventHandler}, virtual_dom::{VElement, VList, VNode}, }; use wal_rsx::rsx; include!("../utils/new_velement_str.rs"); fn main() { single_attribute(); single_key_attribute(); multiple_attributes(); multiple_attributes_self_closing(); fragment_with_key_attribute(); single_expression_attribute(); multiple_expression_and_literal_attributes(); attributes_and_event_attributes(); } fn single_attribute() { let rsx = rsx! {
}; assert_eq!( rsx, VNode::Element(new_velement_str( "div", HashMap::from([("attr", "value")]), Vec::new(), None, Vec::new(), )) ); } fn single_key_attribute() { let rsx = rsx! { }; assert_eq!( rsx, VNode::Element(new_velement_str( "div", HashMap::new(), Vec::new(), Some("value"), Vec::new(), )) ); } fn multiple_attributes() { let rsx = rsx! { }; assert_eq!( rsx, VNode::Element(new_velement_str( "div", HashMap::from([("attr1", "val1"), ("attr2", "val2")]), Vec::new(), None, Vec::new(), )) ); } fn multiple_attributes_self_closing() { let rsx = rsx! { }; assert_eq!( rsx, VNode::Element(new_velement_str( "div", HashMap::from([("attr1", "val1"), ("attr2", "val2")]), Vec::new(), None, Vec::new(), )) ); } fn fragment_with_key_attribute() { let rsx = rsx! {