etherpad-lite/src/tests/frontend/specs/inner_height.js

32 lines
1.6 KiB
JavaScript
Raw Normal View History

2021-03-17 06:51:04 +01:00
'use strict';
describe('height regression after ace.js refactoring', function () {
before(async function () {
await helper.aNewPad();
2021-03-17 06:51:04 +01:00
});
// everything fits inside the viewport
it('clientHeight should equal scrollHeight with few lines', async function () {
2021-04-01 21:22:15 -04:00
await helper.clearPad();
const outerHtml = helper.padChrome$('iframe')[0].contentDocument.documentElement;
// Give some time for the heights to settle.
await new Promise((resolve) => setTimeout(resolve, 100));
expect(outerHtml.clientHeight).to.be(outerHtml.scrollHeight);
2021-03-17 06:51:04 +01:00
});
it('client height should be less than scrollHeight with many lines', async function () {
await helper.clearPad();
await helper.edit('Test line\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\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');
2021-04-01 21:22:15 -04:00
const outerHtml = helper.padChrome$('iframe')[0].contentDocument.documentElement;
// Need to poll because the heights take some time to settle.
await helper.waitForPromise(() => outerHtml.clientHeight < outerHtml.scrollHeight);
2021-03-17 06:51:04 +01:00
});
});