Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  test_paragraph_movement_scroll.html   Sprache: HTML

 

 products/Sources/formale Sprachen/C/Firefox/layout/generic/test/test_paragraph_movement_scroll.html


<!DOCTYPE HTML>
<html>
  <head>
    <meta charset='utf-8'/>
    <title>Paragraph-movement should scroll a horizontally overflowing input</title>
    <!-- Any copyright is dedicated to the Public Domain.
         http://creativecommons.org/publicdomain/zero/1.0/ -->

    <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  </head>
  <body>
    <input id="input" type="text" style="width: 100px; font-family: monospace;"
      value="The quick brown fox jumps over the lazy dog, then jumps back again to verify scrolling behavior in a long URL-like value.">

    <script type="text/javascript">
      SimpleTest.waitForExplicitFinish();

      // Selection::ScrollIntoView defaults to async (posted via the refresh
      // driver), so poll until scrollLeft matches the expected predicate.
      function waitForScrollLeft(input, predicate, label) {
        return SimpleTest.promiseWaitForCondition(
          () => predicate(input.scrollLeft), label);
      }

      async function runTest() {
        let input = document.getElementById("input");
        input.focus();

        let controller = input.editor.selectionController;
        ok(controller, "Precondition: input has a selection controller");

        // Move caret to the end so the input is scrolled all the way right.
        input.setSelectionRange(input.value.length, input.value.length);
        // setSelectionRange does not always update scrollLeft on its own; the
        // following ensures the end of the value is in view.
        input.scrollLeft = input.scrollWidth;
        await waitForScrollLeft(
          input, x => x > 0,
          "Precondition: input must be horizontally scrollable; if the value " +
          "now fits in the visible width the test setup is wrong");
        ok(input.scrollLeft > 0,
           "Precondition: input is scrolled horizontally (scrollLeft=" +
           input.scrollLeft + ")");

        // Move to the beginning of the paragraph. For a single-line input the
        // entire value is one paragraph, so this must move the caret to offset 0
        // AND scroll back to the start of the value.
        controller.paragraphMove(false, false);

        await waitForScrollLeft(
          input, x => x === 0,
          "paragraphMove(begin): input should be scrolled to the start " +
          "(regression guard for bug 2041228)");

        is(input.selectionStart, 0,
           "paragraphMove(begin): selectionStart should be 0");
        is(input.selectionEnd, 0,
           "paragraphMove(begin): selectionEnd should be 0");
        is(input.scrollLeft, 0,
           "paragraphMove(begin): scrollLeft should be 0");

        // Move to the end of the paragraph. Caret must return to the end of the
        // value AND the input must scroll to show it.
        controller.paragraphMove(true, false);

        await waitForScrollLeft(
          input, x => x > 0,
          "paragraphMove(end): input should be scrolled to show the end");

        is(input.selectionStart, input.value.length,
           "paragraphMove(end): selectionStart should be at end of value");
        is(input.selectionEnd, input.value.length,
           "paragraphMove(end): selectionEnd should be at end of value");
        ok(input.scrollLeft > 0,
           "paragraphMove(end): scrollLeft should be > 0 (scrollLeft=" +
           input.scrollLeft + ")");

        SimpleTest.finish();
      }

      SimpleTest.waitForFocus(runTest);
    </script>
  </body>
</html>

Messung V0.5 in Prozent
C=96 H=95 G=95

¤ Dauer der Verarbeitung: 0.21 Sekunden  (vorverarbeitet am  2026-09-28) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1126438
#Domains=1867298