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 () {
|
|
|
|
this.timeout(60000);
|
|
|
|
await new Promise((resolve, reject) => helper.newPad({
|
|
|
|
cb: (err) => (err != null) ? reject(err) : resolve(),
|
|
|
|
hash: 'L4',
|
|
|
|
}));
|
|
|
|
});
|
2020-12-26 21:05:08 +00:00
|
|
|
|
2021-02-07 01:57:37 -05:00
|
|
|
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);
|
|
|
|
});
|
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 () {
|
|
|
|
this.timeout(60000);
|
|
|
|
await new Promise((resolve, reject) => helper.newPad({
|
2021-02-07 01:57:37 -05:00
|
|
|
cb: (err) => (err != null) ? reject(err) : resolve(),
|
2021-02-07 06:39:03 +00:00
|
|
|
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 () {
|
|
|
|
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.
|
|
|
|
});
|
2020-12-26 21:05:08 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|