Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Jan 22, 2024
1 parent e014b39 commit fbdfcb8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions crates/dom/src/dom.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::{Arc, Mutex};

use dioxus_core::{Mutations, VirtualDom};
use dioxus_core::VirtualDom;
use dioxus_native_core::{
prelude::{DioxusState, State},
real_dom::{NodeRef, RealDom},
Expand All @@ -15,7 +15,7 @@ use std::sync::MutexGuard;
use torin::prelude::*;
use tracing::info;

use crate::{dom_adapter::DioxusDOMAdapter, mutations_writer::MutationsWriter};
use crate::mutations_writer::MutationsWriter;

pub type DioxusDOM = RealDom<CustomAttributeValues>;
pub type DioxusNode<'a> = NodeRef<'a, CustomAttributeValues>;
Expand Down
2 changes: 1 addition & 1 deletion crates/testing/src/launch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dioxus_core::fc_to_builder;
use dioxus_core::Element;
use dioxus_core::{Component, VirtualDom};
use dioxus_core::VirtualDom;
use dioxus_core_macro::rsx;
use freya_common::EventMessage;
use freya_core::prelude::*;
Expand Down
24 changes: 12 additions & 12 deletions crates/testing/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use freya_testing::launch_test;

#[tokio::test]
async fn no_state() {
fn no_state_app(cx: Scope) -> Element {
render!(
fn no_state_app() -> Element {
rsx!(
label {
"Hello"
}
Expand All @@ -21,14 +21,14 @@ async fn no_state() {

#[tokio::test]
async fn with_state() {
fn stateful_app(cx: Scope) -> Element {
let state = use_state(cx, || false);
fn stateful_app() -> Element {
let mut state = use_signal(|| false);

let _ = use_memo(cx, (), |_| {
let _ = use_memo(move || {
state.set(true);
});

render!(
rsx!(
label {
"Is enabled? {state}"
}
Expand All @@ -48,8 +48,8 @@ async fn with_state() {

#[tokio::test]
async fn check_size() {
fn stateful_app(cx: Scope) -> Element {
render!(rect {
fn stateful_app() -> Element {
rsx!(rect {
width: "50%",
height: "calc(100% - 70)"
})
Expand All @@ -67,15 +67,15 @@ async fn check_size() {

#[tokio::test]
async fn simulate_events() {
fn stateful_app(cx: Scope) -> Element {
let enabled = use_state(cx, || false);
render!(
fn stateful_app() -> Element {
let mut enabled = use_signal(|| false);
rsx!(
rect {
overflow: "clip",
width: "100%",
height: "100%",
background: "red",
onclick: |_| {
onclick: move |_| {
enabled.set(true);
},
label {
Expand Down

0 comments on commit fbdfcb8

Please sign in to comment.