mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 00:46:16 -04:00
Feature: Scroll to Line number based on Hash IE http://foo.com/p/bar#L10 will scroll to line 10. (#4554)
Includes test coverage Co-authored-by: webzwo0i <webzwo0i@c3d2.de>
This commit is contained in:
parent
e051f2f2f7
commit
38c9827161
6 changed files with 128 additions and 15 deletions
43
tests/frontend/specs/scrollTo.js
Executable file
43
tests/frontend/specs/scrollTo.js
Executable file
|
@ -0,0 +1,43 @@
|
|||
'use strict';
|
||||
|
||||
describe('scrolls to line', function () {
|
||||
// create a new pad with URL hash set before each test run
|
||||
beforeEach(function (cb) {
|
||||
helper.newPad({
|
||||
hash: 'L4',
|
||||
cb,
|
||||
});
|
||||
this.timeout(10000);
|
||||
});
|
||||
|
||||
it('Scrolls down to Line 4', async function () {
|
||||
this.timeout(10000);
|
||||
const chrome$ = helper.padChrome$;
|
||||
await helper.waitForPromise(() => {
|
||||
const topOffset = parseInt(chrome$('iframe').first('iframe')
|
||||
.contents().find('#outerdocbody').css('top'));
|
||||
return (topOffset >= 100);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('doesnt break on weird hash input', function () {
|
||||
// create a new pad with URL hash set before each test run
|
||||
beforeEach(function (cb) {
|
||||
helper.newPad({
|
||||
hash: '#DEEZ123123NUTS',
|
||||
cb,
|
||||
});
|
||||
this.timeout(10000);
|
||||
});
|
||||
|
||||
it('Does NOT change scroll', async function () {
|
||||
this.timeout(10000);
|
||||
const chrome$ = helper.padChrome$;
|
||||
await helper.waitForPromise(() => {
|
||||
const topOffset = parseInt(chrome$('iframe').first('iframe')
|
||||
.contents().find('#outerdocbody').css('top'));
|
||||
return (!topOffset); // no css top should be set.
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue