From b250ceaae754b7d265659295b8eb0b6cd3e6c7b1 Mon Sep 17 00:00:00 2001 From: webzwo0i Date: Wed, 17 Mar 2021 06:51:04 +0100 Subject: [PATCH] add test for wrong clientHeight --- src/tests/frontend/specs/inner_height.js | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/tests/frontend/specs/inner_height.js diff --git a/src/tests/frontend/specs/inner_height.js b/src/tests/frontend/specs/inner_height.js new file mode 100644 index 000000000..526aba88f --- /dev/null +++ b/src/tests/frontend/specs/inner_height.js @@ -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); + }); +});