Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / pasteboard / paste-when-over-link.html
blob3cf50003fd5d4f0b8e9f9f4b7cebff1556b189b3
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p id="description">
5 This test passes if middle mouse clicking on a link where the event handler
6 focuses a textarea does not paste into the textarea.
7 </p>
8 <a href="link" id="link">Link</a>
9 <textarea id="textarea">Content</textarea>
10 <script src="../../resources/dump-as-markup.js"></script>
11 <script>
13 Markup.description(document.getElementById('description').textContent);
15 document.body.focus();
16 document.execCommand('SelectAll', false, null);
17 document.execCommand('Copy', false, null);
19 var textarea = document.getElementById('textarea');
20 var linkElement = document.getElementById('link');
22 linkElement.addEventListener("click", function(e) {
23 e.preventDefault();
24 textarea.focus();
25 });
27 var linkX = linkElement.offsetLeft + linkElement.offsetWidth / 2;
28 var linkY = linkElement.offsetTop + linkElement.offsetHeight / 2;
30 eventSender.mouseMoveTo(linkX, linkY);
31 eventSender.mouseDown(1);
32 eventSender.mouseUp(1);
34 Markup.dump(textarea, 'After middle click on link');
35 </script>
36 </body>
37 </html>