browser_scrollToPoint.js (937B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 /* import-globals-from ../../mochitest/layout.js */ 8 loadScripts({ name: "layout.js", dir: MOCHITESTS_DIR }); 9 10 /** 11 * Test nsIAccessible::scrollToPoint. 12 */ 13 addAccessibleTask( 14 ` 15 <hr style="height: 100vh;"> 16 <p id="p">hi</p> 17 <hr style="height: 100vh;"> 18 `, 19 async function (browser, docAcc) { 20 const [docX, docY] = getPos(docAcc); 21 const p = findAccessibleChildByID(docAcc, "p"); 22 const [pX] = getPos(p); 23 info("Scrolling p"); 24 let scrolled = waitForEvent(EVENT_SCROLLING_END, docAcc); 25 p.scrollToPoint(COORDTYPE_SCREEN_RELATIVE, docX, docY); 26 await scrolled; 27 // We can only scroll this vertically. 28 testPos(p, [pX, docY]); 29 }, 30 { chrome: true, topLevel: true, remoteIframe: true } 31 );