add PopRoot

This commit is contained in:
Evan Almloff 2022-04-04 12:19:21 -05:00
parent 479c12725f
commit 06e8785938
4 changed files with 11 additions and 8 deletions

View file

@ -176,6 +176,9 @@ impl<US: BubbledUpState, DS: PushedDownState> RealDom<US, DS> {
RemoveAttribute { root, .. } => { RemoveAttribute { root, .. } => {
nodes_updated.push(root as usize); nodes_updated.push(root as usize);
} }
PopRoot {} => {
self.node_stack.pop();
}
} }
} }
} }

View file

@ -6,7 +6,7 @@ use dioxus_native_core::real_dom::RealDom;
use std::cell::Cell; use std::cell::Cell;
#[test] #[test]
fn tree_remove_node() { fn remove_node() {
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn Base(cx: Scope) -> Element { fn Base(cx: Scope) -> Element {
rsx!(cx, div {}) rsx!(cx, div {})
@ -80,7 +80,7 @@ fn tree_remove_node() {
} }
#[test] #[test]
fn tree_add_node() { fn add_node() {
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn Base(cx: Scope) -> Element { fn Base(cx: Scope) -> Element {
rsx!(cx, div {}) rsx!(cx, div {})

View file

@ -7,7 +7,7 @@ use dioxus_html as dioxus_elements;
use dioxus_native_core::real_dom::RealDom; use dioxus_native_core::real_dom::RealDom;
#[test] #[test]
fn tree_initial_build_simple() { fn initial_build_simple() {
use std::cell::Cell; use std::cell::Cell;
#[allow(non_snake_case)] #[allow(non_snake_case)]
@ -40,7 +40,7 @@ fn tree_initial_build_simple() {
} }
#[test] #[test]
fn tree_initial_build_with_children() { fn initial_build_with_children() {
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn Base(cx: Scope) -> Element { fn Base(cx: Scope) -> Element {
rsx!(cx, div {}) rsx!(cx, div {})

View file

@ -59,7 +59,7 @@ impl PushedDownState for PushedDownStateTester {
} }
#[test] #[test]
fn tree_state_initial() { fn state_initial() {
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn Base(cx: Scope) -> Element { fn Base(cx: Scope) -> Element {
rsx!(cx, div { rsx!(cx, div {
@ -114,7 +114,7 @@ fn tree_state_initial() {
} }
#[test] #[test]
fn tree_state_reduce_initally_called_minimally() { fn state_reduce_initally_called_minimally() {
#[derive(Debug, Clone, PartialEq, Default)] #[derive(Debug, Clone, PartialEq, Default)]
struct CallCounter(u32); struct CallCounter(u32);
impl BubbledUpState for CallCounter { impl BubbledUpState for CallCounter {
@ -190,7 +190,7 @@ fn tree_state_reduce_initally_called_minimally() {
} }
#[test] #[test]
fn tree_state_reduce_down_called_minimally_on_update() { fn state_reduce_down_called_minimally_on_update() {
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn Base(cx: Scope) -> Element { fn Base(cx: Scope) -> Element {
rsx!(cx, div { rsx!(cx, div {
@ -255,7 +255,7 @@ fn tree_state_reduce_down_called_minimally_on_update() {
} }
#[test] #[test]
fn tree_state_reduce_up_called_minimally_on_update() { fn state_reduce_up_called_minimally_on_update() {
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn Base(cx: Scope) -> Element { fn Base(cx: Scope) -> Element {
rsx!(cx, div { rsx!(cx, div {