diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/html/test/test_bug518122.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/html/test/test_bug518122.html')
-rw-r--r-- | dom/html/test/test_bug518122.html | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/dom/html/test/test_bug518122.html b/dom/html/test/test_bug518122.html new file mode 100644 index 000000000..66e9a95a3 --- /dev/null +++ b/dom/html/test/test_bug518122.html @@ -0,0 +1,126 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=518122 +--> +<head> + <title>Test for Bug 518122</title> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=518122">Mozilla Bug 518122</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script type="application/javascript"> + +/** Test for Bug 518122 **/ + +SimpleTest.waitForExplicitFinish(); +addLoadEvent(runTests); + +var simple_tests = [ ["foo", "foo"], + ["", ""], + [null, ""], + [undefined , "undefined"], + ["\n", "\n"], + ["\r", "\n"], + ["\rfoo", "\nfoo"], + ["foo\r", "foo\n"], + ["foo\rbar", "foo\nbar"], + ["foo\rbar\r", "foo\nbar\n"], + ["\r\n", "\n"], + ["\r\nfoo", "\nfoo"], + ["foo\r\n", "foo\n"], + ["foo\r\nbar", "foo\nbar"], + ["foo\r\nbar\r\n", "foo\nbar\n"] ]; + +var value_append_tests = [ ["foo", "bar", "foobar"], + ["foo", "foo", "foofoo"], + ["foobar", "bar", "foobarbar"], + ["foobar", "foo", "foobarfoo"], + ["foo\n", "foo", "foo\nfoo"], + ["foo\r", "foo", "foo\nfoo"], + ["foo\r\n", "foo", "foo\nfoo"], + ["\n", "\n", "\n\n"], + ["\r", "\r", "\n\n"], + ["\r\n", "\r\n", "\n\n"], + ["\r", "\r\n", "\n\n"], + ["\r\n", "\r", "\n\n"], + [null, null, "null"], + [null, undefined, "undefined"], + ["", "", ""] + ]; + + +var simple_tests_for_input = [ ["foo", "foo"], + ["", ""], + [null, ""], + [undefined , "undefined"], + ["\n", ""], + ["\r", ""], + ["\rfoo", "foo"], + ["foo\r", "foo"], + ["foo\rbar", "foobar"], + ["foo\rbar\r", "foobar"], + ["\r\n", ""], + ["\r\nfoo", "foo"], + ["foo\r\n", "foo"], + ["foo\r\nbar", "foobar"], + ["foo\r\nbar\r\n", "foobar"] ]; + +var value_append_tests_for_input = [ ["foo", "bar", "foobar"], + ["foo", "foo", "foofoo"], + ["foobar", "bar", "foobarbar"], + ["foobar", "foo", "foobarfoo"], + ["foo\n", "foo", "foofoo"], + ["foo\r", "foo", "foofoo"], + ["foo\r\n", "foo", "foofoo"], + ["\n", "\n", ""], + ["\r", "\r", ""], + ["\r\n", "\r\n", ""], + ["\r", "\r\n", ""], + ["\r\n", "\r", ""], + [null, null, "null"], + [null, undefined, "undefined"], + ["", "", ""] + ]; +function runTestsFor(el, simpleTests, appendTests) { + for(var i = 0; i < simpleTests.length; ++i) { + el.value = simpleTests[i][0]; + is(el.value, simpleTests[i][1], "Wrong value (wrap=" + el.getAttribute('wrap') + ", simple_test=" + i + ")"); + } + for (var j = 0; j < appendTests.length; ++j) { + el.value = appendTests[j][0]; + el.value += appendTests[j][1]; + is(el.value, appendTests[j][2], "Wrong value (wrap=" + el.getAttribute('wrap') + ", value_append_test=" + j + ")"); + } +} + +function runTests() { + var textareas = document.getElementsByTagName("textarea"); + for (var i = 0; i < textareas.length; ++i) { + runTestsFor(textareas[i], simple_tests, value_append_tests); + } + var input = document.getElementsByTagName("input")[0]; + runTestsFor(input, simple_tests_for_input, value_append_tests_for_input); + // initialize the editor + input.focus(); + input.blur(); + runTestsFor(input, simple_tests_for_input, value_append_tests_for_input); + SimpleTest.finish(); +} + + +</script> +</pre> +<textarea cols="30" rows="7" wrap="none"></textarea> +<textarea cols="30" rows="7" wrap="off"></textarea><br> +<textarea cols="30" rows="7" wrap="soft"></textarea> +<textarea cols="30" rows="7" wrap="hard"></textarea> +<input type="text"> +</body> +</html> |