diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/client/inspector/markup/test/browser_markup_dragdrop_autoscroll_02.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | devtools/client/inspector/markup/test/browser_markup_dragdrop_autoscroll_02.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_dragdrop_autoscroll_02.js b/devtools/client/inspector/markup/test/browser_markup_dragdrop_autoscroll_02.js new file mode 100644 index 0000000000..1dc69a4ebb --- /dev/null +++ b/devtools/client/inspector/markup/test/browser_markup_dragdrop_autoscroll_02.js @@ -0,0 +1,46 @@ +/* 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 small toolbox. + +const TEST_URL = URL_ROOT + "doc_markup_dragdrop_autoscroll_02.html"; + +add_task(async function () { + // Set the toolbox to very small in size. + await pushPref("devtools.toolbox.footer.height", 150); + + const { inspector } = await openInspectorForURL(TEST_URL); + const markup = inspector.markup; + const 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"); + + markup._onMouseMove({ + preventDefault: () => {}, + target: markup.doc.body, + pageY: viewHeight + markup.doc.defaultView.scrollY, + }); + + const bottomScrollPos = await waitForScrollStop(markup.doc); + ok(bottomScrollPos > 0, "The view was scrolled down"); + info("Simulate a mousemove at the top and expect more scrolling"); + + markup._onMouseMove({ + preventDefault: () => {}, + target: markup.doc.body, + pageY: markup.doc.defaultView.scrollY, + }); + + const topScrollPos = await waitForScrollStop(markup.doc); + 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(); +}); |