/** Test for Bug 542914 **/
SimpleTest.waitForExplicitFinish();
function runTests(callback, type) { var a = $("a");
// Test that the initial value of the control is available to script
// without initilization of the editor
is(a.value, "test", "The value is available before initialization");
// Initialize the editor
a.focus();
// Test that the value does not change after initialization
is(a.value, "test", "The value does not change after initializtion");
var b = $("b");
// Test that the initial value is empty before initialization.
is(b.value, "", "The value is empty before initialization");
// Make sure that the value can be changed before initialization
b.value ="some value";
is(b.value, "some value", "The value can be changed before initialization");
// Initialize the editor
b.focus();
// Make sure that the value does not change after initialization
is(b.value, "some value", "The value does not change after initialization");
// Make sure that the value does not change if the element is hidden
b.style.display = "none";
document.body.offsetHeight;
is(b.value, "some value", "The value does not change while hidden");
b.style.display = "";
document.body.offsetHeight;
b.focus();
is(b.value, "some value", "The value does not change after being shown");
var c = $("c");
// Make sure that the control accepts input events without explicit initialization
is(c.value, "", "Control is empty initially");
c.focus();
sendChar("a");
is(c.value, "a", "Control accepts input without explicit initialization");
// Make sure that the control retains its caret position
c.focus();
c.blur();
c.focus();
sendChar("b");
is(c.value, "ab", "Control retains caret position after being re-focused");
var d = document.createElement("input");
d.setAttribute("type", type);
$("display").appendChild(d);
document.body.offsetHeight;
// Make sure dynamically injected inputs work as expected
is(d.value, "", "Dynamic control's initial value should be empty");
d.value = "new";
d.focus();
is(d.value, "new", "Dynamic control's value can be set before initialization");
sendChar("x");
is(d.value, "newx", "Dynamic control accepts keyboard input without explicit initialization");
$("display").removeChild(d);
is(d.value, "newx", "Dynamic control retains value after being removed from the document");
callback();
}
var gPreviousType = "text";
function setTypes(aType) { var content = document.getElementById("display");
content.innerHTML = content.innerHTML.replace(gPreviousType, aType);
gPreviousType = aType;
}
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.