blob: 0dd6f1979fed0f00c5e0f157ec23437b2748d297 (
plain)
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
44
45
46
47
48
49
50
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that dragging a node near the top or bottom edge of the markup-view
// auto-scrolls the view on a large toolbox.
const TEST_URL = URL_ROOT + "doc_markup_dragdrop_autoscroll_01.html";
add_task(function* () {
// Set the toolbox as large as it would get. The toolbox automatically shrinks
// to not overflow to window.
yield pushPref("devtools.toolbox.footer.height", 10000);
let {inspector} = yield openInspectorForURL(TEST_URL);
let markup = inspector.markup;
let viewHeight = markup.doc.documentElement.clientHeight;
info("Pretend the markup-view is dragging");
markup.isDragging = true;
info("Simulate a mousemove on the view, at the bottom, and expect scrolling");
let onScrolled = waitForScrollStop(markup.doc);
markup._onMouseMove({
preventDefault: () => {},
target: markup.doc.body,
pageY: viewHeight + markup.doc.defaultView.scrollY
});
let bottomScrollPos = yield onScrolled;
ok(bottomScrollPos > 0, "The view was scrolled down");
info("Simulate a mousemove at the top and expect more scrolling");
onScrolled = waitForScrollStop(markup.doc);
markup._onMouseMove({
preventDefault: () => {},
target: markup.doc.body,
pageY: markup.doc.defaultView.scrollY
});
let topScrollPos = yield onScrolled;
ok(topScrollPos < bottomScrollPos, "The view was scrolled up");
is(topScrollPos, 0, "The view was scrolled up to the top");
info("Simulate a mouseup to stop dragging");
markup._onMouseUp();
});
|