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