tor-browser

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

browser_events_caretmove.js (722B)


      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 caret move event and its interface:
      9 *   - caretOffset
     10 */
     11 addAccessibleTask(
     12  '<input id="textbox" value="hello"/>',
     13  async function (browser) {
     14    let onCaretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, "textbox");
     15    await invokeFocus(browser, "textbox");
     16    let event = await onCaretMoved;
     17 
     18    let caretMovedEvent = event.QueryInterface(nsIAccessibleCaretMoveEvent);
     19    is(caretMovedEvent.caretOffset, 5, "Correct caret offset.");
     20  },
     21  { iframe: true, remoteIframe: true }
     22 );