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

Quelle  test_display_mode.html   Sprache: HTML

 
 products/sources/formale Sprachen/C/Firefox/layout/style/test/test_display_mode.html


<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1648157
-->

<head>
  <title>Test for displayMode</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="property_database.js"></script>
  <link rel="stylesheet" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display">
  <iframe id="iframe" src="http://example.org/tests/layout/style/test/media_queries_iframe2.html"></iframe>
</p>
<pre id="test">
<script class="testbody">
let iframe = document.getElementById("iframe");

// Keep in sync with media_queries_iframe2.html
const DISPLAY_MODES_BACKGROUND_COLOR = {
  'minimal-ui''rgb(255, 0, 0)',
  'standalone''rgb(0, 128, 0)',
  'fullscreen''rgb(0, 0, 255)',
  'browser':    'rgb(255, 255, 0)'
};
const DISPLAY_MODES = Object.keys(DISPLAY_MODES_BACKGROUND_COLOR);

SimpleTest.waitForExplicitFinish();

window.addEventListener("load", async (event) => {
  const wrappedWindow = SpecialPowers.wrap(window);

  function setDisplayMode(mode) {
    wrappedWindow.browsingContext.top.displayMode = mode;
  }

  async function displayModeApplies(mode) {
    let responsePromise = new Promise(resolve => {
      window.addEventListener("message", e => {
        resolve(e.data.backgroundColor);
      }, { once: true });
    });
    iframe.contentWindow.postMessage('get-background-color''*');
    let response = await responsePromise;
    let expected = DISPLAY_MODES_BACKGROUND_COLOR[mode];

    info(`displayModeApplies: ${response} === ${expected}`);
    return response === expected;
  }

  async function checkIfApplies(q, shouldApply) {
    let message = shouldApply ? "should apply" : "should not apply";
    is((await displayModeApplies(q)), shouldApply, `${q} ${message}`);
  }

  for (let currentMode of DISPLAY_MODES) {
    setDisplayMode(currentMode);

    for (let mode of DISPLAY_MODES) {
      await checkIfApplies(mode, currentMode === mode);
    }
  }

  SimpleTest.finish();
});
</script>
</pre>
</body>
</html>

Messung V0.5
C=98 H=94 G=95

¤ Dauer der Verarbeitung: 0.1 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.