Commit 3242e5d0 authored by tkent's avatar tkent Committed by Commit bot

Convert textarea-paste-newline.html to the testharness.js style.

textarea-paste-newline.html used dumpAsText() without js-test.js.
This CL has no behaivor changes.
This is a preparation of crbug.com/380471.

BUG=380471

Review URL: https://codereview.chromium.org/1807123002

Cr-Commit-Position: refs/heads/master@{#381669}
parent 73a59b84
<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div id="log"></div>
<textarea id="ta"></textarea>
<script> <script>
function test() test(function() {
{
if (window.testRunner)
testRunner.dumpAsText();
var ta = document.getElementById("ta"); var ta = document.getElementById("ta");
ta.value = "abc\n"; ta.value = "abc\n";
ta.focus(); ta.focus();
ta.setSelectionRange(0, 4); ta.setSelectionRange(0, 4);
document.execCommand("cut"); document.execCommand("cut");
document.execCommand("paste"); document.execCommand("paste");
var result1 = ta.value; assert_equals(ta.value, "abc\n");
ta.setSelectionRange(0, 0); ta.setSelectionRange(0, 0);
document.execCommand("paste"); document.execCommand("paste");
var result2 = ta.value; assert_equals(ta.value, "abc\nabc\n");
}, "Pasting text ending with newline should work correctly.");
if (result1 == "abc\n" && result2 == "abc\nabc\n")
document.write("<p>Hooray, the test was successful!</p>");
else if (result1 == "")
document.write("<p>The test failed; doesn't work in release builds of Safari because paste is not allowed.</p>");
else
document.write("<p>The test failed, result 1 was '" + result1.replace("\n", "\\n") + "' and result 2 was '" + result2.replace("\n", "\\n") + "'.</p>");
}
</script> </script>
<body onload="test()">
<p><textarea id="ta"></textarea></p>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment