add test for wrong clientHeight

This commit is contained in:
webzwo0i 2021-03-17 06:51:04 +01:00 committed by John McLear
parent 3ad1d0a74f
commit b250ceaae7

View file

@ -0,0 +1,31 @@
'use strict';
describe('height regression after ace.js refactoring', function () {
before(function (cb) {
helper.newPad(cb);
});
// everything fits inside the viewport
it('clientHeight should equal scrollHeight with few lines', function() {
const aceOuter = helper.padChrome$('iframe')[0].contentDocument;
const clientHeight = aceOuter.documentElement.clientHeight;
const scrollHeight = aceOuter.documentElement.scrollHeight;
expect(clientHeight).to.be(scrollHeight);
});
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');
const aceOuter = helper.padChrome$('iframe')[0].contentDocument;
const clientHeight = aceOuter.documentElement.clientHeight;
const scrollHeight = aceOuter.documentElement.scrollHeight;
expect(clientHeight).to.be.lessThan(scrollHeight);
});
});