mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
tests: Fix waitForPromise()
in enter.js
This commit is contained in:
parent
c625c611d2
commit
0ff8274d2e
1 changed files with 6 additions and 5 deletions
|
@ -39,21 +39,22 @@ describe('enter keystroke', function () {
|
||||||
while (i < numberOfLines) {
|
while (i < numberOfLines) {
|
||||||
$lastLine = helper.padInner$('div').last();
|
$lastLine = helper.padInner$('div').last();
|
||||||
$lastLine.sendkeys('{enter}');
|
$lastLine.sendkeys('{enter}');
|
||||||
await helper.waitFor(() => helper.padInner$('div').length > previousLineLength);
|
await helper.waitForPromise(() => helper.padInner$('div').length > previousLineLength);
|
||||||
previousLineLength = helper.padInner$('div').length;
|
previousLineLength = helper.padInner$('div').length;
|
||||||
// check we can see the caret..
|
// check we can see the caret..
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
await helper.waitFor(() => helper.padInner$('div').length === numberOfLines + originalLength);
|
await helper.waitForPromise(
|
||||||
|
() => helper.padInner$('div').length === numberOfLines + originalLength);
|
||||||
|
|
||||||
// is edited line fully visible?
|
// is edited line fully visible?
|
||||||
const lastLine = helper.padInner$('div').last();
|
const lastLine = helper.padInner$('div').last();
|
||||||
const bottomOfLastLine = lastLine.offset().top + lastLine.height();
|
const bottomOfLastLine = lastLine.offset().top + lastLine.height();
|
||||||
const scrolledWindow = helper.padChrome$('iframe')[0];
|
const scrolledWindow = helper.padChrome$('iframe')[0];
|
||||||
await helper.waitFor(() => {
|
await helper.waitForPromise(() => {
|
||||||
const scrolledAmount = scrolledWindow.contentWindow.pageYOffset +
|
const scrolledAmount =
|
||||||
scrolledWindow.contentWindow.innerHeight;
|
scrolledWindow.contentWindow.pageYOffset + scrolledWindow.contentWindow.innerHeight;
|
||||||
return scrolledAmount >= bottomOfLastLine;
|
return scrolledAmount >= bottomOfLastLine;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue