sauron 0.70.0

A versatile web framework and library for building client-side and/or server-side web applications
Documentation
extern crate log;
use crate::vdom::TreePath;
use sauron::{html::attributes::*, html::events::*, html::*, *};

use wasm_bindgen_test::*;

wasm_bindgen_test_configure!(run_in_browser);

#[wasm_bindgen_test]
fn nodes_with_event_should_not_recycle() {
    console_log::init_with_level(log::Level::Trace).ok();

    let f = |_| log::trace!("I'm a div");
    let old: Node<()> = div(
        vec![class("container")],
        vec![div(vec![class("child"), on_click(f)], vec![])],
    );

    let new: Node<()> = div(
        vec![class("container")],
        vec![div(vec![class("child")], vec![])],
    );

    let diff = diff(&old, &new);
    log::info!("{:#?}", diff);
    assert_eq!(
        diff,
        vec![Patch::remove_attributes(
            &"div",
            TreePath::new(vec![0]),
            vec![&on_click(f)]
        )]
    );
}