Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / drag-drop-restore.html
blobe4e5b4ca7d86215aa92be1fac8dd929c30c29a82
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body onload="runTest()">
7 <input type="text" id="src">
8 <input type="text" id="dst">
9 <div id="console"></div>
10 <script>
11 description("This test verifies that content of input box could be restored in 'focus' event fired by drag-and-drop.");
13 var oldValue = "foo";
15 function runTest()
17 var src = document.getElementById('src');
18 src.value = "abc";
19 var dst = document.getElementById('dst');
21 function restoreValue()
23 oldValue = src.value;
24 src.value = "abc";
26 dst.addEventListener("focus", restoreValue, false);
28 src.select();
29 eventSender.mouseMoveTo(src.offsetLeft + src.offsetWidth / 2, src.offsetTop + src.offsetHeight / 2);
30 eventSender.mouseDown();
31 eventSender.leapForward(1000);
32 eventSender.mouseMoveTo(dst.offsetLeft + dst.offsetWidth / 2, dst.offsetTop + dst.offsetHeight / 2);
33 eventSender.mouseUp();
35 shouldBeEqualToString("oldValue", "");
36 shouldBeEqualToString("src.value", "abc");
37 shouldBeEqualToString("dst.value", "abc");
39 </script>
40 </body>
41 </html>