<script type="application/javascript">
// We want to test what happens when the user splits a mail cite by clicking
// at the start, the middle and the end of the cite and hitting the enter key.
// Mail cites are spans, and since bug 1288911 they are displayed as blocks.
// The _moz_quote attribute is used to give the cite a blue color via CSS.
// As an internal attribute, it's not returned from the innerHTML.
// To the user the tests look like:
// > mailcite
// This text is 10 characters long, so we position at 0, 5 and 10.
// Althought since bug 1288911 those cites are displayed as block,
// the tests are repeated also for inline display.
// Each entry of the 'tests' array has the original HTML, the offset to click
// at and the expected result HTML. var tests = [
// With style="display: block;".
[ "display: block;\">> mailcite ", 0, "xdisplay: block;\">> mailcite " ],
[ "display: block;\">> mailcite ", 5, "display: block;\">> mai xdisplay: block;\">lcite "],
[ "display: block;\">> mailcite ", 10, "display: block;\">> mailcite x" ],
// No <br> at the end to simulate prior deletion to the end of the quote.
[ "display: block;\">> mailcite", 10, "display: block;\">> mailcite x" ],
// Without style="display: block;".
[ "> mailcite ", 0, "x > mailcite " ],
[ "> mailcite ", 5, "> mai x lcite " ],
[ "> mailcite ", 10, "> mailcite x" ],
// No <br> at the end to simulate prior deletion to the end of the quote.
[ "> mailcite", 10, "> mailcite x" ],
];
/** Test for Bug 1330796 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() { var sel = window.getSelection(); var theEdit = document.getElementById("editable");
makeMailEditor();
for (let i = 0; i < tests.length; i++) {
theEdit.innerHTML = tests[i][0];
theEdit.focus(); var theText = theEdit.firstChild.firstChild;
// Position set at the beginning , middle and end of the text.
sel.collapse(theText, tests[i][1]);
synthesizeKey("KEY_Enter");
sendString("x");
is(theEdit.innerHTML, tests[i][2], "unexpected HTML for test " + i.toString());
}
SimpleTest.finish();
});
function makeMailEditor() { var Ci = SpecialPowers.Ci; var editingSession = SpecialPowers.wrap(window).docShell.editingSession; var editor = editingSession.getEditorForWindow(window);
editor.flags |= Ci.nsIEditor.eEditorMailMask;
}
</script>
</pre>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.25 Sekunden
(vorverarbeitet)
¤
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.