Don't require a path in TestAppContext::dispatch_action
Instead, derive it from the presenter. This makes tests easier to write and more reliable since we'll be accurately simulating the actual relationship between parent and child views.
This commit is contained in:
+11
-9
@@ -426,15 +426,17 @@ impl TestAppContext {
|
||||
cx
|
||||
}
|
||||
|
||||
pub fn dispatch_action<A: Action>(
|
||||
&self,
|
||||
window_id: usize,
|
||||
responder_chain: Vec<usize>,
|
||||
action: A,
|
||||
) {
|
||||
self.cx
|
||||
.borrow_mut()
|
||||
.dispatch_action_any(window_id, &responder_chain, &action);
|
||||
pub fn dispatch_action<A: Action>(&self, window_id: usize, action: A) {
|
||||
let mut cx = self.cx.borrow_mut();
|
||||
let responder_chain = cx
|
||||
.presenters_and_platform_windows
|
||||
.get(&window_id)
|
||||
.unwrap()
|
||||
.0
|
||||
.borrow()
|
||||
.dispatch_path(cx.as_ref());
|
||||
|
||||
cx.dispatch_action_any(window_id, &responder_chain, &action);
|
||||
}
|
||||
|
||||
pub fn dispatch_global_action<A: Action>(&self, action: A) {
|
||||
|
||||
Reference in New Issue
Block a user