45 lines
1.6 KiB
HTML
45 lines
1.6 KiB
HTML
<html>
|
|
<head>
|
|
<script type="text/javascript">
|
|
function print(message)
|
|
{
|
|
var paragraph = document.createElement("li");
|
|
paragraph.appendChild(document.createTextNode(message));
|
|
document.getElementById("console").appendChild(paragraph);
|
|
}
|
|
function test()
|
|
{
|
|
if (window.testRunner) {
|
|
testRunner.dumpAsText();
|
|
}
|
|
var elt = document.getElementById("text");
|
|
elt.value = "This\ris\ra\rtest";
|
|
compare(elt.value, "This\nis\na\ntest");
|
|
elt.value = "And\r\nhere\r\nis\r\ntest\r\ntwo";
|
|
compare(elt.value, "And\nhere\nis\ntest\ntwo");
|
|
elt.value = "And\nlastly,\ntest\nthree";
|
|
compare(elt.value, "And\nlastly,\ntest\nthree");
|
|
elt.value = "";
|
|
}
|
|
function compare(val, exp)
|
|
{
|
|
if (val == exp) {
|
|
print("Passed");
|
|
} else {
|
|
print("Failed");
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="test();">
|
|
<p>This test attempts to set non-standard line endings in a text area and reads them back. The line endings should all come back as linefeeds.</p>
|
|
<p>If the test passes, you should see three lines saying "Passed" below.</p>
|
|
<hr />
|
|
<form>
|
|
<textarea id="text"></textarea>
|
|
</form>
|
|
<hr />
|
|
<p><ol id="console"></ol></p>
|
|
</body>
|
|
</html>
|