justing | 0e8af8d | 2006-11-02 03:52:33 +0000 | [diff] [blame] | 1 | <script> |
rniwa@webkit.org | 14f6b5b | 2012-06-13 08:51:53 +0000 | [diff] [blame] | 2 | if (window.testRunner) |
| 3 | testRunner.dumpEditingCallbacks(); |
ggaren | 3428b38 | 2006-11-03 16:51:39 +0000 | [diff] [blame] | 4 | </script> |
| 5 | <script> |
justing | 0e8af8d | 2006-11-02 03:52:33 +0000 | [diff] [blame] | 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); |
rniwa@webkit.org | 14f6b5b | 2012-06-13 08:51:53 +0000 | [diff] [blame] | 34 | </script> |