Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/LayoutTests/editing/pasteboard/drop-link.html

Issue 1860293003: Serialize original node when dragging a link instead of synthesizing HTML. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete delete Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <script> 1 <script>
2 if (window.testRunner) 2 if (window.testRunner)
3 testRunner.dumpEditingCallbacks(); 3 testRunner.dumpEditingCallbacks();
4 </script> 4 </script>
5 <div>This test checks that links dragged into editable regions preserve their ti tle and URL.</div> 5 <div>This test checks that links dragged into editable regions preserve their ti tle and URL.</div>
6 6
7 <div contenteditable="true" id="destination">Hello</div> 7 <div contenteditable="true" id="destination">Hello</div>
8 <div contenteditable="true" id="destination2">Goodbye</div> 8 <div contenteditable="true" id="destination2">Goodbye</div>
9 9
10 <div><a href="http://apple.com" id="grabme">This is a link</a></div> 10 <div><a href="http://apple.com" id="grabme">This is a link</a></div>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 eventSender.mouseDown(); 50 eventSender.mouseDown();
51 // Wait a moment so that the mouseDown will kick off a drag instead of navig ating to the link 51 // Wait a moment so that the mouseDown will kick off a drag instead of navig ating to the link
52 eventSender.leapForward(400); 52 eventSender.leapForward(400);
53 53
54 var destinationObject = document.getElementById(targetId); 54 var destinationObject = document.getElementById(targetId);
55 var x = destinationObject.offsetLeft + destinationObject.offsetWidth / 2; 55 var x = destinationObject.offsetLeft + destinationObject.offsetWidth / 2;
56 var y = destinationObject.offsetTop + destinationObject.offsetHeight / 2; 56 var y = destinationObject.offsetTop + destinationObject.offsetHeight / 2;
57 57
58 eventSender.mouseMoveTo(x, y); 58 eventSender.mouseMoveTo(x, y);
59 eventSender.mouseUp(); 59 eventSender.mouseUp();
60
61 // Clear id on the cloned link created from the drag and drop.
62 document.querySelector("a[id]").removeAttribute('id');
60 } 63 }
61 64
62 function verifier() { 65 function verifier() {
63 var anchorToDrag = document.getElementById("grabme"); 66 var anchorToDrag = document.getElementById("grabme");
64 var anchorToDrag2 = document.getElementById("grabme2"); 67 var anchorToDrag2 = document.getElementById("grabme2");
65 68
66 var passed = verifyLink('grabme', 0) && verifyLink('grabme2', 1); 69 var passed = verifyLink('grabme', 0) && verifyLink('grabme2', 1);
67 70
68 var anchors = document.getElementsByTagName("a"); 71 var anchors = document.getElementsByTagName("a");
69 if (anchors.length != 2) { 72 if (anchors.length != 2) {
(...skipping 15 matching lines...) Expand all
85 anchorParent.removeChild(anchorToDrag); 88 anchorParent.removeChild(anchorToDrag);
86 89
87 var anchors = document.getElementsByTagName("a"); 90 var anchors = document.getElementsByTagName("a");
88 if (!anchors[linkNumber]) { 91 if (!anchors[linkNumber]) {
89 log("Link " + linkNumber + " not found"); 92 log("Link " + linkNumber + " not found");
90 passed = false; 93 passed = false;
91 } else { 94 } else {
92 log("Link is " + anchors[linkNumber].href); 95 log("Link is " + anchors[linkNumber].href);
93 var passed = true; 96 var passed = true;
94 if (anchors[linkNumber].href != originalTarget) { 97 if (anchors[linkNumber].href != originalTarget) {
95 log("Failure! Link targets differ"); 98 log("Failure! Expected target: " + anchors[linkNumber].href + ", act ual target: " + originalTarget);
96 passed = false; 99 passed = false;
97 } 100 }
98 if (anchors[linkNumber].innerText != originalText) { 101 if (anchors[linkNumber].innerText != originalText) {
99 log("Failure! Link texts differ"); 102 log("Failure! Expected text: " + anchors[linkNumber].innerText + ", actual text: " + originalText);
100 passed = false; 103 passed = false;
101 } 104 }
102 } 105 }
103 return passed; 106 return passed;
104 } 107 }
105 108
106 runTest(); 109 runTest();
107 </script> 110 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698