Further refactoring of the tests

This commit is contained in:
Pieter Vander Vennet 2022-03-23 19:48:06 +01:00
parent 3ab373f6ec
commit 2dac893bb3
31 changed files with 2498 additions and 2992 deletions

View file

@ -158,10 +158,11 @@ export class UIEventSource<T> {
)
}
public AsPromise(): Promise<T> {
public AsPromise(condition?: ((t: T )=> boolean)): Promise<T> {
const self = this;
condition = condition ?? (t => t !== undefined)
return new Promise((resolve, reject) => {
if (self.data !== undefined) {
if (condition(self.data)) {
resolve(self.data)
} else {
self.addCallbackD(data => {