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


Quelle  test_inline_style_cache.html   Sprache: HTML

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


<!DOCTYPE html>
<html>
<head>
  <title>Tests for inline style cache</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none;">

</div>

<div id="editor" contenteditable></div>
<pre id="test">

<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
  var editor = document.getElementById("editor");
  editor.focus();

  document.execCommand("defaultParagraphSeparator", false, "div");

  var selection = window.getSelection();

  // #01-01 Typing something after setting some styles should insert some nodes to insert text.
  editor.innerHTML = "beforeafter";
  selection.collapse(editor.firstChild, "before".length);
  document.execCommand("bold");
  document.execCommand("italic");
  document.execCommand("strikethrough");
  sendString("test");

  is(editor.innerHTML, "beforetestafter",
     "#01-01 At typing something after setting some styles, should cause inserting some nodes to apply the style");

  // #01-02 Typing something after removing some characters after setting some styles should work as without removing some character.
  editor.innerHTML = "beforeafter";
  selection.collapse(editor.firstChild, "before".length);
  document.execCommand("bold");
  document.execCommand("italic");
  document.execCommand("strikethrough");
  synthesizeKey("KEY_Delete");
  sendString("test");

  todo_is(
    editor.innerHTML,
    "beforetestfter",
    "#01-02-1 At typing something after Delete after setting style, the style should not be preserved for compatibility with the other browsers"
  );
  is(
    editor.innerHTML,
    "beforetestfter",
    "#01-02-1 At typing something after Delete after setting style, the style should not be preserved, but it's okay to do it for backward compatibility"
  );

  editor.innerHTML = "beforeafter";
  selection.collapse(editor.firstChild, "before".length);
  document.execCommand("bold");
  document.execCommand("italic");
  document.execCommand("strikethrough");
  synthesizeKey("KEY_Backspace");
  sendString("test");

  is(editor.innerHTML, "befortestafter",
     "#01-02-2 At typing something after Backspace after setting style, should cause inserting some nodes to apply the style");

  // #03-01 Replacing in <b style="font-weight: normal;"> shouldn't cause new .
  editor.innerHTML = "font-weight: normal;\">beforeselectionafter";
  selection.collapse(editor.firstChild.firstChild, "before".length);
  selection.extend(editor.firstChild.firstChild, "beforeselection".length);
  sendString("test");

  is(editor.innerHTML, "font-weight: normal;\">beforetestafter",
     "#03-01 Replacing text in styled inline elements should respect the styles");

  // #03-02 Typing something after removing selected text in <b style="font-weight: normal;"> shouldn't cause new .
  editor.innerHTML = "font-weight: normal;\">beforeselectionafter";
  selection.collapse(editor.firstChild.firstChild, "before".length);
  selection.extend(editor.firstChild.firstChild, "beforeselection".length);
  synthesizeKey("KEY_Backspace");
  sendString("test");

  is(editor.innerHTML, "font-weight: normal;\">beforetestafter",
     "#03-02 Inserting text after removing text in styled inline elements should respect the styles");

  // #03-03 Typing something after typing Enter at selected text in <b style="font-weight: normal;"> shouldn't cause new .
  editor.innerHTML = "font-weight: normal;\">beforeselectionafter";
  selection.collapse(editor.firstChild.firstChild, "before".length);
  selection.extend(editor.firstChild.firstChild, "beforeselection".length);
  synthesizeKey("KEY_Enter");
  sendString("test");

  is(editor.innerHTML, "
font-weight: normal;\">before
font-weight: normal;\">testafter
"
,
     "#03-03-1 Inserting text after typing Enter at selected text in styled inline elements should respect the styles");

  editor.innerHTML = "

font-weight: normal;\">beforeselectionafter

"
;
  selection.collapse(editor.firstChild.firstChild.firstChild, "before".length);
  selection.extend(editor.firstChild.firstChild.firstChild, "beforeselection".length);
  synthesizeKey("KEY_Enter");
  sendString("test");

  is(editor.innerHTML, "

font-weight: normal;\">before

font-weight: normal;\">testafter

"
,
     "#03-03-2 Inserting text after typing Enter at selected text in styled inline elements should respect the styles");

  // #04-01 Replacing in some styled inline elements shouldn't cause new same elements.
  editor.innerHTML = "text-decoration: none;\">font-style: normal;\">font-weight: normal;\">beforeselectionafter";
  selection.collapse(editor.firstChild.firstChild.firstChild.firstChild, "before".length);
  selection.extend(editor.firstChild.firstChild.firstChild.firstChild, "beforeselection".length);
  sendString("test");

  is(editor.innerHTML, "text-decoration: none;\">font-style: normal;\">font-weight: normal;\">beforetestafter",
     "#04-01 Replacing text in styled inline elements should respect the styles");

  // #04-02 Typing something after removing selected text in some styled inline elements shouldn't cause new same elements.
  editor.innerHTML = "text-decoration: none;\">font-style: normal;\">font-weight: normal;\">beforeselectionafter";
  selection.collapse(editor.firstChild.firstChild.firstChild.firstChild, "before".length);
  selection.extend(editor.firstChild.firstChild.firstChild.firstChild, "beforeselection".length);
  synthesizeKey("KEY_Backspace");
  sendString("test");

  is(editor.innerHTML, "text-decoration: none;\">font-style: normal;\">font-weight: normal;\">beforetestafter",
     "#04-02 Inserting text after removing text in styled inline elements should respect the styles");

  // #04-03 Typing something after typing Enter at selected text in some styled inline elements shouldn't cause new same elements.
  editor.innerHTML = "text-decoration: none;\">font-style: normal;\">font-weight: normal;\">beforeselectionafter";
  selection.collapse(editor.firstChild.firstChild.firstChild.firstChild, "before".length);
  selection.extend(editor.firstChild.firstChild.firstChild.firstChild, "beforeselection".length);
  synthesizeKey("KEY_Enter");
  sendString("test");

  is(editor.innerHTML, "
text-decoration: none;\">font-style: normal;\">font-weight: normal;\">before
text-decoration: none;\">font-style: normal;\">font-weight: normal;\">testafter
"
,
     "#04-03-1 Inserting text after typing Enter at selected text in styled inline elements should respect the styles");

  editor.innerHTML = "

text-decoration: none;\">font-style: normal;\">font-weight: normal;\">beforeselectionafter

"
;
  selection.collapse(editor.firstChild.firstChild.firstChild.firstChild.firstChild"before".length);
  selection.extend(editor.firstChild.firstChild.firstChild.firstChild.firstChild, "beforeselection".length);
  synthesizeKey("KEY_Enter");
  sendString("test");

  is(editor.innerHTML, "

text-decoration: none;\">font-style: normal;\">font-weight: normal;\">before

text-decoration: none;\">font-style: normal;\">font-weight: normal;\">testafter

"
,
     "#04-03-2 Inserting text after typing Enter at selected text in styled inline elements should respect the styles");

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

Messung V0.5
C=93 H=96 G=94

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






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge