Fix compile checks on numerous packages using --all --all-features

This commit is contained in:
Jonathan Kelley committed 2024-01-18 16:27:43 -08:00
1 parent 3506b3ea72
commit d8af9b7ed1
38 files changed
+147 -186

No files matched your search

+26 -21
View File
@@ -1,12 +1,12 @@
use dioxus::prelude::*;
use dioxus_core::Element;
use dioxus_desktop::DesktopContext;
use dioxus_desktop::{window, DesktopContext};
fn main() {
check_app_exits(check_html_renders);
}
pub(crate) fn check_app_exits(app: Component) {
pub(crate) fn check_app_exits(app: fn() -> Element) {
use dioxus_desktop::Config;
use tao::window::WindowBuilder;
// This is a deadman's switch to ensure that the app exits
@@ -19,30 +19,35 @@ pub(crate) fn check_app_exits(app: Component) {
}
});
dioxus_desktop::launch_cfg(
app,
Config::new().with_window(WindowBuilder::new().with_visible(true)),
);
LaunchBuilder::desktop()
.with_cfg(Config::new().with_window(WindowBuilder::new().with_visible(true)))
.launch(app);
should_panic.store(false, std::sync::atomic::Ordering::SeqCst);
}
fn use_inner_html(d: &'static str) -> Option<String> {
let value: Signal<Option<String>> = use_signal(|| None);
use_effect(|| async move {
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
window().eval();
let html = eval_provider(&format!(
r#"let element = document.getElementById('{}');
fn use_inner_html(id: &'static str) -> Option<String> {
let mut value = use_signal(|| None as Option<String>);
use_effect(move || {
spawn(async move {
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
let res = dioxus::eval(format!(
r#"let element = document.getElementById('{}');
return element.innerHTML"#,
id
))
.unwrap();
if let Ok(serde_json::Value::String(html)) = html.await {
println!("html: {}", html);
value.set(Some(html));
}
id
))
.await;
if let Ok(html) = res {
// serde_json::Value::String(html)
println!("html: {}", html);
value.set(Some(html));
}
});
});
value.read().clone()
}
@@ -51,7 +56,7 @@ const EXPECTED_HTML: &str = r#"<div id="5" style="width: 100px; height: 100px; c
fn check_html_renders() -> Element {
let inner_html = use_inner_html("main_div");
let desktop_context: DesktopContext = cx.consume_context().unwrap();
let desktop_context: DesktopContext = consume_context();
if let Some(raw_html) = inner_html {
println!("{}", raw_html);