Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/dom/base/test/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  browser_outline_refocus.js   Sprache: JAVA

 
const URL = `data:text/html,<a target="_blank" href="http://example.com">Click me`;

async function test_browser_outline_refocus(
  aMessage,
  aShouldFocusBeVisible,
  aOpenTabCallback
) {
  await BrowserTestUtils.withNewTab(URL, async function (browser) {
    let tab = gBrowser.getTabForBrowser(browser);
    let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser);

    await aOpenTabCallback(browser);

    info("waiting for new tab");
    let newTab = await newTabPromise;

    is(gBrowser.selectedTab, newTab, "Should've switched to the new tab");

    info("switching back");
    await BrowserTestUtils.switchTab(gBrowser, tab);

    info("checking focus");
    let [wasFocused, wasFocusVisible] = await SpecialPowers.spawn(
      browser,
      [],
      () => {
        let link = content.document.querySelector("a");
        return [link.matches(":focus"), link.matches(":focus-visible")];
      }
    );

    ok(wasFocused, "Link should be refocused");
    is(wasFocusVisible, aShouldFocusBeVisible, aMessage);

    info("closing tab");
    await BrowserTestUtils.removeTab(newTab);
  });
}

add_task(async function browser_outline_refocus_mouse() {
  await test_browser_outline_refocus(
    "Link shouldn't show outlines since it was originally focused by mouse",
    false,
    function (aBrowser) {
      info("clicking on link");
      return BrowserTestUtils.synthesizeMouseAtCenter("a", {}, aBrowser);
    }
  );
});

add_task(async function browser_outline_refocus_key() {
  await SpecialPowers.pushPrefEnv({
    set: [["accessibility.tabfocus", 7]],
  });

  await test_browser_outline_refocus(
    "Link should show outlines since it was originally focused by keyboard",
    true,
    function (aBrowser) {
      info("Navigating via keyboard");
      EventUtils.sendKey("tab");
      EventUtils.sendKey("return");
    }
  );
});

Messung V0.5
C=99 H=100 G=99

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.