function testLineBreak(div, type, expectedText, expectedHTML, callback) { div.focus();
getSelection().collapse(div, 0);
type();
is(div.innerHTML, expectedHTML, "The expected HTML after editing should be correct");
requestAnimationFrame(function() {
SimpleTest.waitForClipboard(expectedText,
function() {
getSelection().selectAllChildren(div);
synthesizeKey("C", {accelKey: true});
},
function() { var t = document.createElement("textarea");
document.body.appendChild(t);
t.focus();
synthesizeKey("V", {accelKey: true});
is(t.value, expectedText, "The expected text should be copied to the clipboard");
callback();
},
function() {
SimpleTest.finish();
}
);
});
}
function typeABCDEF() {
sendString("a");
typeBCDEF_chars();
}
function typeBCDEF() {
synthesizeKey("KEY_ArrowRight");
typeBCDEF_chars();
}
function typeBCDEF_chars() {
sendString("bc");
synthesizeKey("KEY_Enter");
sendString("def");
}
/** Test for Bug 551704 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
document.execCommand("defaultParagraphSeparator", false, "div");
var preformatted = document.getElementById("preformatted");
is(preformatted.innerHTML, "a\nb", "No BR node should be injected for preformatted editable fields");
variframe = document.createElement("iframe"); iframe.addEventListener("load", function() { var sel = iframe.contentWindow.getSelection();
is(sel.rangeCount, 0, "There should be no range in the selection initially"); iframe.contentDocument.designMode = "on";
sel = iframe.contentWindow.getSelection();
is(sel.rangeCount, 1, "There should be a single range in the selection after setting designMode"); var range = sel.getRangeAt(0);
ok(range.collapsed, "The range should be collapsed");
is(range.startContainer, iframe.contentDocument.body.firstChild, "The range should start on the text");
is(range.startOffset, 0, "The start offset should be zero");
function continueTest() { var divs = [];
for (var i = 0; i < 8; ++i) {
divs[i] = document.getElementById("test" + (i + 1));
} var current = 0;
function doNextTest() {
if (current == divs.length) {
SimpleTest.finish();
return;
} vardiv = divs[current++];
let type;
if (div.textContent == "a") {
type = typeBCDEF;
} else {
type = typeABCDEF;
} var expectedHTML = "
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.