2020-12-26 21:05:08 +00:00
|
|
|
'use strict';
|
|
|
|
|
2021-02-07 01:57:37 -05:00
|
|
|
describe('scrollTo.js', function () {
|
|
|
|
describe('scrolls to line', function () {
|
|
|
|
// create a new pad with URL hash set before each test run
|
|
|
|
before(async function () {
|
2021-03-31 21:14:02 -04:00
|
|
|
await helper.aNewPad({hash: 'L4'});
|
2021-02-07 01:57:37 -05:00
|
|
|
});
|
2020-12-26 21:05:08 +00:00
|
|
|
|
2021-02-07 01:57:37 -05:00
|
|
|
it('Scrolls down to Line 4', async function () {
|
|
|
|
const chrome$ = helper.padChrome$;
|
|
|
|
await helper.waitForPromise(() => {
|
|
|
|
const topOffset = parseInt(chrome$('iframe').first('iframe')
|
|
|
|
.contents().find('#outerdocbody').css('top'));
|
|
|
|
return (topOffset >= 100);
|
|
|
|
});
|
2020-12-26 21:05:08 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-02-07 06:39:03 +00:00
|
|
|
describe('doesnt break on weird hash input', function () {
|
|
|
|
// create a new pad with URL hash set before each test run
|
|
|
|
before(async function () {
|
2021-03-31 21:14:02 -04:00
|
|
|
await helper.aNewPad({hash: '#DEEZ123123NUTS'});
|
2020-12-26 21:05:08 +00:00
|
|
|
});
|
|
|
|
|
2021-02-07 06:39:03 +00:00
|
|
|
it('Does NOT change scroll', async function () {
|
|
|
|
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.
|
|
|
|
});
|
2020-12-26 21:05:08 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|