From a30b120b0e3b3cafec41060bb53a0493a5fdc9f9 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 31 Dec 2020 10:30:10 +0000 Subject: [PATCH] more page up down tests this time including shift spuport --- tests/frontend/specs/pageupdown.js | 59 +++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/tests/frontend/specs/pageupdown.js b/tests/frontend/specs/pageupdown.js index 72a29d6ae..c01893647 100644 --- a/tests/frontend/specs/pageupdown.js +++ b/tests/frontend/specs/pageupdown.js @@ -1,4 +1,5 @@ 'use strict'; +/* describe('Page Up/Down', function () { beforeEach(function (cb) { helper.newPad({ @@ -295,6 +296,7 @@ describe('Viewport based Page Up/Down', function () { await helper.waitForPromise(() => currentLineNumber < 5); }); }); +*/ describe('Shift Page Up/Down', function () { beforeEach(function (cb) { helper.newPad({ @@ -307,7 +309,7 @@ describe('Shift Page Up/Down', function () { }); }); - it('highlights multiple lines on shift page down', async function () { + it('highlights lines on shift page down and releases them on page up', async function () { await helper.edit('xxx', 1); // caret is offset 6 helper.pageUp(); @@ -315,5 +317,60 @@ describe('Shift Page Up/Down', function () { shift: true, }); await helper.waitForPromise(() => helper.padInner$.document.getSelection().type === 'Range'); + + helper.pageUp({ + shift: true, + }); + await helper.waitForPromise(() => helper.padInner$.document.getSelection().type === 'Caret'); + }); + + it('highlights lines on shift page down and maintains first selection on page up', async function () { + await helper.edit('xxx', 1); // caret is offset 6 + + helper.pageUp(); + helper.pageDown({ + shift: true, + }); + await helper.waitForPromise(() => helper.padInner$.document.getSelection().type === 'Range'); + + helper.pageDown({ + shift: true, + }); + await helper.waitForPromise(() => helper.padInner$.document.getSelection().type === 'Range'); + + helper.pageUp({ + shift: true, + }); + await helper.waitForPromise(() => helper.padInner$.document.getSelection().type === 'Range'); + }); + + + it('highlights from end of document on page up then releases them on shift page down', async function () { + helper.pageUp({ + shift: true, + }); + await helper.waitForPromise(() => helper.padInner$.document.getSelection().type === 'Range'); + + helper.pageDown({ + shift: true, + }); + await helper.waitForPromise(() => helper.padInner$.document.getSelection().type === 'Caret'); + }); + + it('highlights from end of document on page up twice and retains on single page down', async function () { + helper.pageUp({ + shift: true, + }); + await helper.waitForPromise(() => helper.padInner$.document.getSelection().type === 'Range'); + + helper.pageUp({ + shift: true, + }); + await helper.waitForPromise(() => helper.padInner$.document.getSelection().type === 'Range'); + + helper.pageDown({ + shift: true, + }); + await helper.waitForPromise(() => helper.padInner$.document.getSelection().type === 'Range'); }); });