fix dioxus core event tests
This commit is contained in:
1 parent
9e623d52cb
commit
bd38cddc9f
4 files changed
+155
-4
No files matched your search
@@ -36,6 +36,7 @@ serde = { version = "1", features = ["derive"], optional = true }
|
||||
[dev-dependencies]
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
dioxus = { workspace = true }
|
||||
dioxus-html = { workspace = true, features = ["serialize"] }
|
||||
pretty_assertions = "1.3.0"
|
||||
rand = "0.8.5"
|
||||
dioxus-ssr = { workspace = true }
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//! Tests for the lifecycle of components.
|
||||
use dioxus::core::{ElementId, Mutation::*};
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_html::SerializedHtmlEventConverter;
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
@@ -39,6 +40,7 @@ fn manual_diffing() {
|
||||
|
||||
#[test]
|
||||
fn events_generate() {
|
||||
set_event_converter(Box::new(SerializedHtmlEventConverter));
|
||||
fn app(cx: Scope) -> Element {
|
||||
let count = cx.use_hook(|| 0);
|
||||
|
||||
@@ -58,9 +60,9 @@ fn events_generate() {
|
||||
|
||||
dom.handle_event(
|
||||
"click",
|
||||
Rc::new(PlatformEventData::new(Box::new(MouseData::new(
|
||||
Rc::new(PlatformEventData::new(Box::new(
|
||||
SerializedMouseData::default(),
|
||||
)))),
|
||||
))),
|
||||
ElementId(1),
|
||||
true,
|
||||
);
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
use crate::dioxus_elements::SerializedMouseData;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_core::ElementId;
|
||||
use dioxus_elements::SerializedHtmlEventConverter;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[test]
|
||||
fn miri_rollover() {
|
||||
set_event_converter(Box::new(SerializedHtmlEventConverter));
|
||||
let mut dom = VirtualDom::new(app);
|
||||
|
||||
_ = dom.rebuild();
|
||||
@@ -11,9 +14,9 @@ fn miri_rollover() {
|
||||
for _ in 0..3 {
|
||||
dom.handle_event(
|
||||
"click",
|
||||
Rc::new(PlatformEventData::new(Box::new(MouseData::new(
|
||||
Rc::new(PlatformEventData::new(Box::new(
|
||||
SerializedMouseData::default(),
|
||||
)))),
|
||||
))),
|
||||
ElementId(2),
|
||||
true,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user