mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
testing: provide tick() that can be called anywhere in tests
This commit is contained in:
parent
531c39759a
commit
7ecfbd9109
1 changed files with 9 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue