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

Quelle  test_fullscreen_modal.html   Sprache: HTML

 
 products/sources/formale Sprachen/C/Firefox/dom/base/test/fullscreen/test_fullscreen_modal.html


<!doctype html>
<title>Test for bug 1771150</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<style>
  #fullscreen {
    background-color: rgba(0, 255, 0, .5);
  }
  #fullscreen::backdrop {
    background-color: transparent;
  }
  #fullscreen, #fullscreen::backdrop {
    pointer-events: none;
  }
</style>
<div id="fullscreen"></div>
<button>Go fullscreen</button>
<script>
const button = document.querySelector("button");
let clickCount = 0;
let lastFullscreenPromise = null;
let shouldEnterFullscreen = false;
button.addEventListener("click", function() {
  clickCount++;
  if (shouldEnterFullscreen) {
    const fullscreenElement = document.getElementById("fullscreen");
    lastFullscreenPromise = SimpleTest.promiseFocus().then(() => {
      fullscreenElement.focus();
      return fullscreenElement.requestFullscreen();
    });
  }
});

function clickButton(expectEvent) {
  let lastClickCount = clickCount;
  synthesizeMouseAtCenter(button, {});
  (expectEvent ? isnot : is)(clickCount, lastClickCount, `Should've ${expectEvent ? "" : "not "}been able to click`);
}

function enterFullscreen() {
  lastFullscreenPromise = null;
  shouldEnterFullscreen = true;
  clickButton(true);
  shouldEnterFullscreen = false;
  isnot(lastFullscreenPromise, null, "Should be transitioning to fullscreen");
  return lastFullscreenPromise;
}

async function testFullscreenIsModal(modal) {
  info("testing modal: " + modal);
  is(document.fullscreenElement, null, "Shouldn't be in fullscreen");

  await enterFullscreen();

  clickButton(/* expectEvent = */ !modal);

  ok(document.fullscreenElement.matches(":fullscreen"), "Fullscreen element matches :fullscreen");
  is(document.fullscreenElement.matches(":modal"), modal, "Fullscreen element matches :modal");

  // Before exiting fullscreen, wait on the document becoming active,
  // which signifies that the fullscreen request has been completely
  // processed. It is important that the fullscreen request is all
  // the way done, or the exit fullscreen request could be dropped.
  let documentWrapper = SpecialPowers.wrap(document);
  await SimpleTest.promiseWaitForCondition(() => documentWrapper.isActive(),
                                           "Timed out waiting for document to become active.");
  ok(documentWrapper.isActive(), "Document is active.");

  await document.exitFullscreen();
  clickButton(/* expectEvent = */ true);
}

add_task(async function() {
  await testFullscreenIsModal(true);
});

</script>

Messung V0.5
C=95 H=100 G=97

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© 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.