fix: desktop and mobile
This commit is contained in:
1 parent
f66cda4bed
commit
601078f9cf
23 files changed
+670
-132
No files matched your search
@@ -42,13 +42,13 @@ serde_repr = { version = "0.1.7", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = "1.0.42"
|
||||
async-std = { version = "1.9.0", features = ["attributes"] }
|
||||
criterion = "0.3.5"
|
||||
dioxus-html = { path = "../html" }
|
||||
fern = { version = "0.6.0", features = ["colored"] }
|
||||
rand = { version = "0.8.4", features = ["small_rng"] }
|
||||
simple_logger = "1.13.0"
|
||||
dioxus-core-macro = { path = "../core-macro", version = "0.1.2" }
|
||||
async-std = { version = "1.9.0", features = ["attributes"] }
|
||||
criterion = "0.3.5"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
@@ -7,9 +7,9 @@ fn main() {
|
||||
|
||||
const App: FC<()> = |(cx, props)| {
|
||||
let id = cx.scope_id();
|
||||
cx.submit_task(Box::pin(async move { id }));
|
||||
// cx.submit_task(Box::pin(async move { id }));
|
||||
|
||||
let (handle, contents) = use_task(cx, || async { "hello world".to_string() });
|
||||
// let (handle, contents) = use_task(cx, || async { "hello world".to_string() });
|
||||
|
||||
todo!()
|
||||
};
|
||||
@@ -1,9 +1,16 @@
|
||||
use dioxus::{nodes::VSuspended, prelude::*, DomEdit, TestDom};
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_core as dioxus;
|
||||
use dioxus_core_macro::*;
|
||||
use dioxus_html as dioxus_elements;
|
||||
|
||||
static Parent: FC<()> = |(cx, props)| {
|
||||
#[test]
|
||||
fn test_borrowed_state() {
|
||||
let _ = VirtualDom::new(Parent);
|
||||
}
|
||||
|
||||
fn Parent((cx, _): Component<()>) -> DomTree {
|
||||
let value = cx.use_hook(|_| String::new(), |f| &*f, |_| {});
|
||||
|
||||
cx.render(rsx! {
|
||||
@@ -14,11 +21,11 @@ static Parent: FC<()> = |(cx, props)| {
|
||||
Child { name: value }
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Props)]
|
||||
struct ChildProps<'a> {
|
||||
name: &'a String,
|
||||
name: &'a str,
|
||||
}
|
||||
|
||||
fn Child<'a>((cx, props): Component<'a, ChildProps>) -> DomTree<'a> {
|
||||
@@ -32,7 +39,7 @@ fn Child<'a>((cx, props): Component<'a, ChildProps>) -> DomTree<'a> {
|
||||
|
||||
#[derive(Props)]
|
||||
struct Grandchild<'a> {
|
||||
name: &'a String,
|
||||
name: &'a str,
|
||||
}
|
||||
|
||||
fn Child2<'a>((cx, props): Component<'a, Grandchild>) -> DomTree<'a> {
|
||||
@@ -40,6 +47,3 @@ fn Child2<'a>((cx, props): Component<'a, Grandchild>) -> DomTree<'a> {
|
||||
div { "Hello {props.name}!" }
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_borrowed_state() {}
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(unused, non_upper_case_globals)]
|
||||
|
||||
//! Prove that the dom works normally through virtualdom methods.
|
||||
//!
|
||||
//! This methods all use "rebuild" which completely bypasses the scheduler.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(unused, non_upper_case_globals)]
|
||||
//! Diffing Tests
|
||||
//!
|
||||
//! These tests only verify that the diffing algorithm works properly for single components.
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
#![allow(unused, non_upper_case_globals)]
|
||||
|
||||
//! test that we can display the virtualdom properly
|
||||
//!
|
||||
//!
|
||||
//!
|
||||
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_core as dioxus;
|
||||
use dioxus_core_macro::*;
|
||||
use dioxus_html as dioxus_elements;
|
||||
mod test_logging;
|
||||
|
||||
const IS_LOGGING_ENABLED: bool = true;
|
||||
|
||||
#[test]
|
||||
fn please_work() {
|
||||
static App: FC<()> = |(cx, props)| {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
use bumpalo::Bump;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use dioxus::{prelude::*, DomEdit};
|
||||
use dioxus_core as dioxus;
|
||||
use dioxus_core_macro::*;
|
||||
use dioxus_html as dioxus_elements;
|
||||
|
||||
#[async_std::test]
|
||||
async fn event_queue_works() {
|
||||
static App: FC<()> = |(cx, props)| {
|
||||
cx.render(rsx! {
|
||||
div { "hello world" }
|
||||
})
|
||||
};
|
||||
|
||||
let mut dom = VirtualDom::new(App);
|
||||
let edits = dom.rebuild();
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_core as dioxus;
|
||||
use dioxus_html as dioxus_elements;
|
||||
|
||||
type Shared<T> = Rc<RefCell<T>>;
|
||||
|
||||
#[test]
|
||||
fn sample_refs() {
|
||||
|
||||
// static App: FC<()> = |(cx, props)|{
|
||||
// let div_ref = use_node_ref::<MyRef, _>(cx);
|
||||
|
||||
// cx.render(rsx! {
|
||||
// div {
|
||||
// style: { color: "red" },
|
||||
// node_ref: div_ref,
|
||||
// onmouseover: move |_| {
|
||||
// div_ref.borrow_mut().focus();
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
// };
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Tests for the lifecycle of components.
|
||||
#![allow(unused, non_upper_case_globals)]
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
//! Tests for the lifecycle of components.
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_core as dioxus;
|
||||
use dioxus_core_macro::*;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use dioxus::{nodes::VSuspended, prelude::*, DomEdit, TestDom};
|
||||
#![allow(unused, non_upper_case_globals)]
|
||||
|
||||
use dioxus::{prelude::*, DomEdit, TestDom};
|
||||
use dioxus_core as dioxus;
|
||||
use dioxus_core_macro::*;
|
||||
use dioxus_html as dioxus_elements;
|
||||
@@ -7,12 +9,6 @@ use DomEdit::*;
|
||||
|
||||
mod test_logging;
|
||||
|
||||
fn new_dom() -> TestDom {
|
||||
const IS_LOGGING_ENABLED: bool = false;
|
||||
test_logging::set_up_logging(IS_LOGGING_ENABLED);
|
||||
TestDom::new()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shared_state_test() {
|
||||
struct MySharedState(&'static str);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
pub fn set_up_logging(enabled: bool) {
|
||||
use fern::colors::{Color, ColoredLevelConfig};
|
||||
|
||||
|
||||
if !enabled {
|
||||
return;
|
||||
@@ -19,7 +18,7 @@ pub fn set_up_logging(enabled: bool) {
|
||||
// configure colors for the name of the level.
|
||||
// since almost all of them are the same as the color for the whole line, we
|
||||
// just clone `colors_line` and overwrite our changes
|
||||
let colors_level = colors_line.clone().info(Color::Green);
|
||||
let colors_level = colors_line.info(Color::Green);
|
||||
// here we set up our fern Dispatch
|
||||
|
||||
// when running tests in batch, the logger is re-used, so ignore the logger error
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(unused, non_upper_case_globals)]
|
||||
|
||||
//! Rebuilding tests
|
||||
//! ----------------
|
||||
//!
|
||||
|
||||
Reference in new issue
Block a user