-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
scrollTo.js
executable file
·43 lines (39 loc) · 1.14 KB
/
scrollTo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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.
});
});
});