use sauron::html::*; use sauron::*; use test_fixtures::simple_program; use wasm_bindgen_test::*; mod test_fixtures; wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] fn multiple_match_on_keyed_elements() { console_log::init_with_level(log::Level::Trace).ok(); console_error_panic_hook::set_once(); let current_dom: Node<()> = node!(

"Lines"

"0"
"\n"
"1"
"C"
"J"
"K"
"\n"
"2"
"\n"
"3"
"T"
"h"
"e"
"\n"
"line: 1, column: 0"
); let target_dom: Node<()> = node!(

"Lines"

"0"
"\n"
"1"
"\n"
"2"
"C"
"J"
"K"
"\n"
"3"
"\n"
"4"
"T"
"h"
"e"
"\n"
"line: 2, column: 0"
); let patches = diff(¤t_dom, &target_dom); log::trace!("patches: {:#?}", patches); log::trace!("current_dom: {}", current_dom.render_to_string()); log::trace!("target_dom: {}", target_dom.render_to_string()); let mut simple_program = simple_program(); simple_program .update_dom_with_vdom(current_dom.clone()) .expect("must not error"); let target_dom_html = target_dom.render_to_string(); simple_program .update_dom_with_vdom(target_dom) .expect("must not error"); let app_node = crate::document() .query_selector(".app") .expect("must not error") .expect("must exist"); assert_eq!(target_dom_html, app_node.outer_html()); }