mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-24 17:36:14 -04:00
linted tests
This commit is contained in:
parent
6d8a28b993
commit
79630c7ab6
6 changed files with 357 additions and 561 deletions
|
@ -1,41 +1,41 @@
|
|||
'use strict';
|
||||
|
||||
describe('Viewport based Page Up/Down', function () {
|
||||
beforeEach(function (cb) {
|
||||
helper.newPad({
|
||||
cb: async () => {
|
||||
await helper.clearPad();
|
||||
// 200 lines
|
||||
await helper.edit(
|
||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n');
|
||||
cb();
|
||||
},
|
||||
});
|
||||
});
|
||||
it('page up when top is at 100 and caret is at bottom', async function () {
|
||||
// by default page down when caret is at end of the document will leave it in the same place.
|
||||
// viewport based pageup/down changes that
|
||||
const initialLineNumber = helper.caretLineNumber();
|
||||
helper.pageDown();
|
||||
helper.padOuter$('#outerdocbody').parent().scrollTop(100);
|
||||
helper.pageUp();
|
||||
await helper.waitForPromise(() => helper.caretLineNumber() < initialLineNumber);
|
||||
});
|
||||
|
||||
it('page down when top is at 0 and caret is at bottom', async function () {
|
||||
// by default page down when caret is at end of the document will leave it in the same place.
|
||||
// viewport based pageup/down changes that
|
||||
const initialLineNumber = helper.caretLineNumber();
|
||||
helper.padOuter$('#outerdocbody').parent().scrollTop(0);
|
||||
await helper.waitForPromise(() => helper.padOuter$('#outerdocbody').parent().scrollTop() === 0);
|
||||
helper.pageUp(); // I think this might not be right..
|
||||
helper.pageDown();
|
||||
|
||||
await helper.waitForPromise(() => (helper
|
||||
.caretLineNumber() < initialLineNumber) && (helper.caretLineNumber() > 1));
|
||||
});
|
||||
});
|
||||
'use strict';
|
||||
|
||||
describe('Viewport based Page Up/Down', function () {
|
||||
beforeEach(function (cb) {
|
||||
helper.newPad({
|
||||
cb: async () => {
|
||||
await helper.clearPad();
|
||||
// 200 lines
|
||||
await helper.edit(
|
||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' +
|
||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n');
|
||||
cb();
|
||||
},
|
||||
});
|
||||
});
|
||||
it('page up when top is at 100 and caret is at bottom', async function () {
|
||||
// by default page down when caret is at end of the document will leave it in the same place.
|
||||
// viewport based pageup/down changes that
|
||||
const initialLineNumber = helper.caretLineNumber();
|
||||
helper.pageDown();
|
||||
helper.padOuter$('#outerdocbody').parent().scrollTop(100);
|
||||
helper.pageUp();
|
||||
await helper.waitForPromise(() => helper.caretLineNumber() < initialLineNumber);
|
||||
});
|
||||
|
||||
it('page down when top is at 0 and caret is at bottom', async function () {
|
||||
// by default page down when caret is at end of the document will leave it in the same place.
|
||||
// viewport based pageup/down changes that
|
||||
const initialLineNumber = helper.caretLineNumber();
|
||||
helper.padOuter$('#outerdocbody').parent().scrollTop(0);
|
||||
await helper.waitForPromise(() => helper.padOuter$('#outerdocbody').parent().scrollTop() === 0);
|
||||
helper.pageUp(); // I think this might not be right..
|
||||
helper.pageDown();
|
||||
|
||||
await helper.waitForPromise(() => (helper
|
||||
.caretLineNumber() < initialLineNumber) && (helper.caretLineNumber() > 1));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue