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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/inserting/replace-at-visible-boundary.html

Issue 2693813002: Selection API: Some functions should throw InvalidNodeTypeError and IndexSizeError. (Closed)
Patch Set: adjust 2 more tests Created 3 years, 10 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 <body contentEditable="true"> 1 <body contentEditable="true">
2 <b id="bold">bold</b>regular text<br> 2 <b id="bold">bold</b>regular text<br>
3 </body> 3 </body>
4 <script src="../editing.js"></script> 4 <script src="../editing.js"></script>
5 <script> 5 <script>
6 if (window.testRunner) 6 if (window.testRunner)
7 testRunner.dumpAsText(); 7 testRunner.dumpAsText();
8 8
9 function fail(msg) { 9 function fail(msg) {
10 console.log(msg); 10 console.log(msg);
11 throw msg; 11 throw msg;
12 } 12 }
13 13
14 // Inserting HTML over "regular text" shouldn't be in the bold tag. 14 // Inserting HTML over "regular text" shouldn't be in the bold tag.
15 var bold = document.getElementById("bold"); 15 var bold = document.getElementById("bold");
16 var unboldText = bold.nextSibling; 16 var unboldText = bold.nextSibling;
17 execSetSelectionCommand(unboldText, 0, unboldText, unboldText.textContent.le ngth); 17 execSetSelectionCommand(unboldText, 0, unboldText, unboldText.textContent.le ngth);
18 document.execCommand("insertHTML", false, "<img id='img' src='../resources/a be.png' /> not bold"); 18 document.execCommand("insertHTML", false, "<img id='img' src='../resources/a be.png' /> not bold");
19 19
20 // Verify that the image isn't in the bold tag. 20 // Verify that the image isn't in the bold tag.
21 var image = document.getElementById("img"); 21 var image = document.getElementById("img");
22 if (image.previousSibling != bold) 22 if (image.previousSibling != bold)
23 fail("Image should be adjacent to the bold node."); 23 fail("Image should be adjacent to the bold node.");
24 24
25 // Now try inserting HTML over the image. 25 // Now try inserting HTML over the image.
26 execSetSelectionCommand(image, 0, image, 1); 26 execSetSelectionCommand(image, 0, image, 0);
27 document.execCommand("inserthtml", false, "<span id='red' style='color:red'> red text</span>"); 27 document.execCommand("inserthtml", false, "<span id='red' style='color:red'> red text</span>");
28 28
29 // Verify that the red text isn't in the bold tag. 29 // Verify that the red text isn't in the bold tag.
30 var red = document.getElementById("red"); 30 var red = document.getElementById("red");
31 if (red.previousSibling != bold) 31 if (red.previousSibling != bold)
32 fail("Red text should be adjacent to the bold node."); 32 fail("Red text should be adjacent to the bold node.");
33 33
34 // Replace text with SUCCESS. 34 // Replace text with SUCCESS.
35 document.body.innerHTML = "SUCCESS"; 35 document.body.innerHTML = "SUCCESS";
36 </script> 36 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698