From f1091150172404eef0b5ed3218bebddfb9185618 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 2 Mar 2021 15:25:49 +0000 Subject: [PATCH] side div line number alignment --- src/tests/frontend/specs/line_numbers.js | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/tests/frontend/specs/line_numbers.js diff --git a/src/tests/frontend/specs/line_numbers.js b/src/tests/frontend/specs/line_numbers.js new file mode 100644 index 000000000..034eaee2c --- /dev/null +++ b/src/tests/frontend/specs/line_numbers.js @@ -0,0 +1,35 @@ +'use strict'; + +describe('Side Div Line Numbers', function () { + // create a new pad before each test run + beforeEach(function (cb) { + helper.newPad(cb); + this.timeout(60000); + }); + + it('numbers line up with content', async () => { + this.timeout(100); + const inner$ = helper.padInner$; + + // get the first text element out of the inner iframe + const $firstLine = inner$('div').first(); + + // select this text element + let i = 0; + while (i < 40) { + $firstLine + .sendkeys('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'); + i++; + } + + const $firstLineNumber = helper.padOuter$('#sidedivinner').children().first("div"); + const $secondLine = $firstLine.next(); + await helper.waitForPromise( + () => helper.padOuter$('#sidedivinner').children('div').first().next().text() === "2" + ) + const $secondLineNumber = $firstLineNumber.next(); + expect($firstLine.offset().top).to.be.below($firstLineNumber.offset().top); + expect($secondLine.offset().top).to.be.below($secondLineNumber.offset().top); + }); + +});