mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 17:06:16 -04:00
tests: Fix races in inner_height.js
This commit is contained in:
parent
4ad80d4072
commit
58dac4c0fc
1 changed files with 8 additions and 8 deletions
|
@ -7,10 +7,11 @@ describe('height regression after ace.js refactoring', function () {
|
||||||
|
|
||||||
// everything fits inside the viewport
|
// everything fits inside the viewport
|
||||||
it('clientHeight should equal scrollHeight with few lines', async function () {
|
it('clientHeight should equal scrollHeight with few lines', async function () {
|
||||||
const aceOuter = helper.padChrome$('iframe')[0].contentDocument;
|
await helper.clearPad();
|
||||||
const clientHeight = aceOuter.documentElement.clientHeight;
|
const outerHtml = helper.padChrome$('iframe')[0].contentDocument.documentElement;
|
||||||
const scrollHeight = aceOuter.documentElement.scrollHeight;
|
// Give some time for the heights to settle.
|
||||||
expect(clientHeight).to.be(scrollHeight);
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||||
|
expect(outerHtml.clientHeight).to.be(outerHtml.scrollHeight);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('client height should be less than scrollHeight with many lines', async function () {
|
it('client height should be less than scrollHeight with many lines', async function () {
|
||||||
|
@ -23,9 +24,8 @@ describe('height regression after ace.js refactoring', function () {
|
||||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
||||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
||||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n');
|
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n');
|
||||||
const aceOuter = helper.padChrome$('iframe')[0].contentDocument;
|
const outerHtml = helper.padChrome$('iframe')[0].contentDocument.documentElement;
|
||||||
const clientHeight = aceOuter.documentElement.clientHeight;
|
// Need to poll because the heights take some time to settle.
|
||||||
const scrollHeight = aceOuter.documentElement.scrollHeight;
|
await helper.waitForPromise(() => outerHtml.clientHeight < outerHtml.scrollHeight);
|
||||||
expect(clientHeight).to.be.lessThan(scrollHeight);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue