Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / pasteboard / drop-inputtext-acquires-style.html
blobd7e3469eff43d23179eb2a4e6483dc347fd943ec
1 <html>
2 <script>
3 if (window.testRunner)
4 testRunner.dumpAsText();
5 </script>
6 <div>This test checks that the plain text dropped into a styled text region will acquire the appropriate style.</div>
7 <p>To run this test manually, drag the text in the input element below into the bold text region. The dropped text should be bold.
8 Click the verify button to check.</p>
9 <input type="button" value="Verify" onClick="verifier()">
10 <br />
11 <input id="grabme" value="Drag this text" >
12 <br />
13 <b contenteditable="true" id="destination">Drag the text from the above input element into this bold text</b>
14 <ul id="console"></ul>
16 <script>
17 function log(message) {
18 var console = document.getElementById("console");
19 var li = document.createElement("li");
20 var pre = document.createElement("pre");
21 pre.appendChild(document.createTextNode(message));
22 li.appendChild(pre);
23 console.appendChild(li);
26 function runTest() {
27 var textToDrag = document.getElementById("grabme");
28 textToDrag.select();
30 if (!window.testRunner)
31 return;
33 var x = textToDrag.offsetLeft + textToDrag.offsetWidth / 2;
34 var y = textToDrag.offsetTop + textToDrag.offsetHeight / 2;
36 eventSender.mouseMoveTo(x, y);
38 eventSender.mouseDown();
39 // Wait a moment so that the mouseDown will kick off a drag
40 eventSender.leapForward(400);
42 var destinationObject = document.getElementById("destination");
43 var x = destinationObject.offsetLeft + destinationObject.offsetWidth / 2;
44 var y = destinationObject.offsetTop + destinationObject.offsetHeight / 2;
47 eventSender.mouseMoveTo(x, y);
48 eventSender.mouseUp();
50 verifier();
53 function verifier() {
54 log(document.getElementById("destination").outerHTML);
55 if (document.getElementById("destination").childNodes.length == 1)
56 log("SUCCESS");
57 else
58 log("FAILURE");
61 runTest();
62 </script>
63 </html>