mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 00:46:16 -04:00
tests: add waitForPromise method and test for it
This commit is contained in:
parent
86c0648ede
commit
a3f062af96
2 changed files with 58 additions and 0 deletions
|
@ -197,6 +197,17 @@ var helper = {};
|
|||
return deferred;
|
||||
};
|
||||
|
||||
/**
|
||||
* Same as `waitFor` but using Promises
|
||||
*
|
||||
*/
|
||||
helper.waitForPromise = async function(...args) {
|
||||
// Note: waitFor() has a strange API: On timeout it rejects, but it also throws an uncatchable
|
||||
// exception unless .fail() has been called. That uncatchable exception is disabled here by
|
||||
// passing a no-op function to .fail().
|
||||
return await this.waitFor(...args).fail(() => {});
|
||||
};
|
||||
|
||||
helper.selectLines = function($startLine, $endLine, startOffset, endOffset){
|
||||
// if no offset is provided, use beginning of start line and end of end line
|
||||
startOffset = startOffset || 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue