This commit is contained in:
Jonathan Kelley committed 2024-01-05 23:15:30 -08:00
1 parent 20135368b8
commit a95f4dfe0d
2 files changed
+19 -4

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ fn compose(cx: Scope<ComposeProps>) -> Element {
},
"Click to send"
}
input { oninput: move |e| user_input.set(e.value()), value: "{user_input}" }
}
})
+18 -3
View File
@@ -12,7 +12,12 @@ fn events_propagate() {
_ = dom.rebuild();
// Top-level click is registered
dom.handle_event("click", Rc::new(PlatformEventData::new(Box::<SerializedMouseData>::default())), ElementId(1), true);
dom.handle_event(
"click",
Rc::new(PlatformEventData::new(Box::<SerializedMouseData>::default())),
ElementId(1),
true,
);
assert_eq!(*CLICKS.lock().unwrap(), 1);
// break reference....
@@ -22,7 +27,12 @@ fn events_propagate() {
}
// Lower click is registered
dom.handle_event("click", Rc::new(PlatformEventData::new(Box::<SerializedMouseData>::default())), ElementId(2), true);
dom.handle_event(
"click",
Rc::new(PlatformEventData::new(Box::<SerializedMouseData>::default())),
ElementId(2),
true,
);
assert_eq!(*CLICKS.lock().unwrap(), 3);
// break reference....
@@ -32,7 +42,12 @@ fn events_propagate() {
}
// Stop propagation occurs
dom.handle_event("click", Rc::new(PlatformEventData::new(Box::<SerializedMouseData>::default())), ElementId(2), true);
dom.handle_event(
"click",
Rc::new(PlatformEventData::new(Box::<SerializedMouseData>::default())),
ElementId(2),
true,
);
assert_eq!(*CLICKS.lock().unwrap(), 3);
}