Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/editor/libeditor/tests/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 4 kB image not shown  

Quelle  test_bug478725.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/editor/libeditor/tests/test_bug478725.html


<!DOCTYPE HTML>
<html><head>
<title>Test for bug 478725</title>
<style src="/tests/SimpleTest/test.css" type="text/css"></style>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>

<script class="testbody" type="application/javascript">

function runTest() {
  function verifyContent(s) {
    var e = document.getElementById("i1");
    var doc = e.contentDocument;
    is(doc.body.innerHTML, s, "");
  }

  function pasteInto(html, target_id) {
    var e = document.getElementById("i1");
    var doc = e.contentDocument;
    doc.designMode = "on";
    doc.body.innerHTML = html;
    e = doc.getElementById(target_id);
    doc.defaultView.focus();
    var selection = doc.defaultView.getSelection();
    selection.removeAllRanges();
    selection.selectAllChildren(e);
    selection.collapseToEnd();
    SpecialPowers.wrap(doc).execCommand("paste", false, null);
   return e;
  }

  function copyToClipBoard(s, asHTML, target_id) {
    var e = document.getElementById("i2");
    var doc = e.contentDocument;
    if (asHTML) {
      doc.body.innerHTML = s;
    } else {
      var text = doc.createTextNode(s);
      doc.body.appendChild(text);
    }
    doc.designMode = "on";
    doc.defaultView.focus();
    var selection = doc.defaultView.getSelection();
    selection.removeAllRanges();
    if (!target_id) {
      selection.selectAllChildren(doc.body);
    } else {
      var range = document.createRange();
      range.selectNode(doc.getElementById(target_id));
      selection.addRange(range);
    }
    SpecialPowers.wrap(doc).execCommand("copy", false, null);
    return e;
  }

  copyToClipBoard("
Hello Kitty
"
, true);
  pasteInto('
  1. X
'
"paste_here");
  verifyContent('
  1. X
    Hello Kitty
'
);

  copyToClipBoard("
  • Hello Kitty
  • "
    , true);
      pasteInto('
    1. X
    '
    "paste_here");
      verifyContent('
    1. X
    2. Hello Kitty
    '
    );

      copyToClipBoard("
    1. Hello Kitty
    "
    , true);
      pasteInto('
    1. X
    '
    "paste_here");
      verifyContent('
    1. X
    2. Hello Kitty
    '
    );

      copyToClipBoard("
    • Hello Kitty
    "
    , true);
      pasteInto('
    1. X
    '
    "paste_here");
      verifyContent('
    1. X
    2. Hello Kitty
    '
    );

      copyToClipBoard("
    • Hello
      • Kitty
    "
    , true);
      pasteInto('
    1. X
    '
    "paste_here");
      verifyContent('
    1. X
    2. Hello
      • Kitty
    '
    );

      copyToClipBoard("
    Hello
    Kitty
    "
    , true);
      pasteInto('
    X
    '
    "paste_here");
      verifyContent('
    X
    Hello
    Kitty
    '
    );

      copyToClipBoard("
    Hello
    Kitty
    "
    , true);
      pasteInto('
    X
    '
    "paste_here");
      verifyContent('
    X
    Hello
    Kitty
    '
    );

      copyToClipBoard("
    Hello
    Kitty
    "
    , true);
      pasteInto('
    X
    '
    "paste_here");
      verifyContent('
    X
    Hello
    Kitty
    '
    );

      copyToClipBoard("
    Kitty
    "
    , true);
      pasteInto('
    Hello 
    '
    "paste_here");
      verifyContent('
    Hello Kitty
    '
    );

    // I was expecting these to trigger the special TABLE/TR rules in nsHTMLEditor::InsertHTMLWithContext
    // but they don't for some reason...
    //  copyToClipBoard('
    Kitty
    '
    , true, "copy_here");
    //  pasteInto('
    Hello
    '
    ,"paste_here");
    //  verifyContent('');
    //
    //  copyToClipBoard('
    Kitty
    '
    , true, "copy_here");
    //  pasteInto('
    Hello
    '
    ,"paste_here");
    //  verifyContent('');
    //
    //  copyToClipBoard('
    Kitty
    '
    , true, "copy_here");
    //  pasteInto('
    Hello
    '
    ,"paste_here");
    //  verifyContent('');
    //
    //  copyToClipBoard('
    Kitty
    '
    , true, "copy_here");
    //  pasteInto('
    Hello
    '
    ,"paste_here");
    //  verifyContent('');


      SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addLoadEvent(runTest);
    </script>
    </head>
    <body>
    <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=478725">Mozilla Bug 478725</a>
    <p id="display"></p>

    <pre id="test">
    </pre>


    <iframe id="i1" width="200" height="100" src="about:blank"></iframe><br>
    <iframe id="i2" width="200" height="100" src="about:blank"></iframe><br>

    </body>
    </html>

    100%


    ¤ Dauer der Verarbeitung: 0.30 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 ist noch experimentell.