mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-27 09:54:41 -05:00
testing: provide tick() that can be called anywhere in tests
This commit is contained in:
@@ -107,6 +107,15 @@ impl Executor {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Waits until the next "tick" of the current async executor.
|
||||
pub async fn tick() {
|
||||
let (tx, rx) = futures::channel::oneshot::channel();
|
||||
Executor::spawn(async move {
|
||||
_ = tx.send(());
|
||||
});
|
||||
_ = rx.await;
|
||||
}
|
||||
}
|
||||
|
||||
impl Executor {
|
||||
|
||||
Reference in New Issue
Block a user