tests: Fix `waitForPromise()` in `enter.js`

pull/4720/head
Richard Hansen 2021-02-07 02:11:28 -05:00 committed by John McLear
parent c625c611d2
commit 0ff8274d2e
1 changed files with 6 additions and 5 deletions

View File

@ -39,21 +39,22 @@ describe('enter keystroke', function () {
while (i < numberOfLines) {
$lastLine = helper.padInner$('div').last();
$lastLine.sendkeys('{enter}');
await helper.waitFor(() => helper.padInner$('div').length > previousLineLength);
await helper.waitForPromise(() => helper.padInner$('div').length > previousLineLength);
previousLineLength = helper.padInner$('div').length;
// check we can see the caret..
i++;
}
await helper.waitFor(() => helper.padInner$('div').length === numberOfLines + originalLength);
await helper.waitForPromise(
() => helper.padInner$('div').length === numberOfLines + originalLength);
// is edited line fully visible?
const lastLine = helper.padInner$('div').last();
const bottomOfLastLine = lastLine.offset().top + lastLine.height();
const scrolledWindow = helper.padChrome$('iframe')[0];
await helper.waitFor(() => {
const scrolledAmount = scrolledWindow.contentWindow.pageYOffset +
scrolledWindow.contentWindow.innerHeight;
await helper.waitForPromise(() => {
const scrolledAmount =
scrolledWindow.contentWindow.pageYOffset + scrolledWindow.contentWindow.innerHeight;
return scrolledAmount >= bottomOfLastLine;
});
});