mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-04 22:27:10 -04:00
tests: Use async
/await
instead of returning Promises
This has a few benefits: * It's more readable: It's easier for a user of the function to know that they should use `await` when calling the function. * Stack traces are more useful. * Some code (e.g., the async npm package) uses introspection to determine if a function is `async` vs. takes a callback.
This commit is contained in:
parent
b164a34e64
commit
3790c0e41c
2 changed files with 20 additions and 20 deletions
|
@ -13,11 +13,11 @@ helper.contentWindow = () => $('#iframe-container iframe')[0].contentWindow;
|
|||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
helper.showChat = () => {
|
||||
helper.showChat = async () => {
|
||||
const chaticon = helper.chatIcon();
|
||||
if (!chaticon.hasClass('visible')) return;
|
||||
chaticon.click();
|
||||
return helper.waitForPromise(() => !chaticon.hasClass('visible'), 2000);
|
||||
await helper.waitForPromise(() => !chaticon.hasClass('visible'), 2000);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -25,10 +25,10 @@ helper.showChat = () => {
|
|||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
helper.hideChat = () => {
|
||||
helper.hideChat = async () => {
|
||||
if (!helper.isChatboxShown() || helper.isChatboxSticky()) return;
|
||||
helper.titlecross().click();
|
||||
return helper.waitForPromise(() => !helper.isChatboxShown(), 2000);
|
||||
await helper.waitForPromise(() => !helper.isChatboxShown(), 2000);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue