Missed a few tests in my last check-in, and checked in old results for
[WebKit-https.git] / LayoutTests / editing / pasteboard / input-field-1.html
1 <script>
2 if (window.layoutTestController)
3     layoutTestController.dumpEditingCallbacks();
4 </script>
5 <script>
6 function log(str) {
7     var li = document.createElement("li");
8     li.appendChild(document.createTextNode(str));
9     var console = document.getElementById("console");
10     console.appendChild(li);
11 }
12 function shouldBe(expected, actual) {
13     if (expected != actual)
14         log("Failure. Expected: " + expected + ", Actual: " + actual);
15     else
16         log("Passed");
17 }
18 </script>
19
20 <p>This tests Copy/Paste of a input field.</p>
21 <div id="div" contenteditable="true"><input type="text"></div>
22 <ul id="console"></ul>
23 <script>
24 var div = document.getElementById("div");
25 div.focus();
26 document.execCommand("SelectAll");
27
28 document.execCommand("Copy");
29 var sel = window.getSelection();
30 sel.modify("move", "forward", "character");
31 document.execCommand("Paste");
32
33 shouldBe(document.getElementsByTagName("input").length, 2);
34 </script>