tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_scrolling.js (904B)


      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 /**
      8 * Test that EVENT_SYSTEM_SCROLLINGSTART fires on the hypertext parent for text
      9 * fragments.
     10 */
     11 addAccessibleTask(
     12  `
     13 <p id="first">The first phrase.</p>
     14 <p id="second">The <i>second <b>phrase.</b></i></p>
     15  `,
     16  async function testTextFragment(browser) {
     17    info("Navigating to text fragment: second phrase");
     18    await runPython(`
     19      global scrolled
     20      scrolled = WaitForWinEvent(EVENT_SYSTEM_SCROLLINGSTART, "second")
     21    `);
     22    await invokeContentTask(browser, [], () => {
     23      content.location.hash = "#:~:text=second%20phrase";
     24    });
     25    await runPython(`
     26      scrolled.wait()
     27    `);
     28    ok(true, "second paragraph got EVENT_SYSTEM_SCROLLINGSTART");
     29  }
     30 );