blob: 6e1247230ca75563a3a5a9a236dd4675b78b7277 [file] [log] [blame]
justing0e8af8d2006-11-02 03:52:33 +00001<script>
rniwa@webkit.org14f6b5b2012-06-13 08:51:53 +00002if (window.testRunner)
3 testRunner.dumpEditingCallbacks();
ggaren3428b382006-11-03 16:51:39 +00004</script>
5<script>
justing0e8af8d2006-11-02 03:52:33 +00006function 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}
12function 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>
24var div = document.getElementById("div");
25div.focus();
26document.execCommand("SelectAll");
27
28document.execCommand("Copy");
29var sel = window.getSelection();
30sel.modify("move", "forward", "character");
31document.execCommand("Paste");
32
33shouldBe(document.getElementsByTagName("input").length, 2);
rniwa@webkit.org14f6b5b2012-06-13 08:51:53 +000034</script>