all native-core tests passing

This commit is contained in:
Evan Almloff committed 2023-03-12 15:35:48 -05:00
1 parent ec3e02e4bb
commit 865c5aa957
11 files changed
+350 -324

No files matched your search

+11 -7
View File
@@ -3,9 +3,12 @@ use dioxus_core::*;
use dioxus_native_core::{
dioxus::DioxusState,
node_ref::{AttributeMaskBuilder, NodeMaskBuilder, NodeView},
prelude::*,
real_dom::RealDom,
Dependancy, SendAnyMap, State,
};
use dioxus_native_core_macro::partial_derive_state;
use shipyard::Component;
use std::cell::Cell;
fn random_ns() -> Option<&'static str> {
@@ -231,7 +234,7 @@ fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute {
static mut TEMPLATE_COUNT: usize = 0;
#[derive(PartialEq, Props)]
#[derive(PartialEq, Props, Component)]
struct DepthProps {
depth: usize,
root: bool,
@@ -293,11 +296,12 @@ fn create_random_element(cx: Scope<DepthProps>) -> Element {
node
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[derive(Debug, Clone, PartialEq, Eq, Default, Component)]
pub struct BlablaState {
count: usize,
}
#[partial_derive_state]
impl State for BlablaState {
type ParentDependencies = (Self,);
type ChildDependencies = ();
@@ -312,7 +316,7 @@ impl State for BlablaState {
_: NodeView,
_: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
_: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
_: Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>,
_: &SendAnyMap,
) -> bool {
if let Some((parent,)) = parent {
@@ -327,7 +331,7 @@ impl State for BlablaState {
node_view: NodeView<()>,
node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
children: Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>,
context: &SendAnyMap,
) -> Self {
let mut myself = Self::default();
@@ -353,7 +357,7 @@ fn create() {
dioxus_state.apply_mutations(&mut rdom, mutations);
let ctx = SendAnyMap::new();
rdom.update_state(ctx, false);
rdom.update_state(ctx);
}
}
@@ -375,13 +379,13 @@ fn diff() {
dioxus_state.apply_mutations(&mut rdom, mutations);
let ctx = SendAnyMap::new();
rdom.update_state(ctx, false);
rdom.update_state(ctx);
for _ in 0..10 {
let mutations = vdom.render_immediate();
dioxus_state.apply_mutations(&mut rdom, mutations);
let ctx = SendAnyMap::new();
rdom.update_state(ctx, false);
rdom.update_state(ctx);
}
}
}