Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / inserting / replace-at-visible-boundary.html
blobc7626fb2ddb3eb4f36fe02a944344cd3ba4f97df
1 <body contentEditable="true">
2 <b id="bold">bold</b>regular text<br>
3 </body>
4 <script src="../editing.js"></script>
5 <script>
6 if (window.testRunner)
7 testRunner.dumpAsText();
9 function fail(msg) {
10 console.log(msg);
11 throw msg;
14 // Inserting HTML over "regular text" shouldn't be in the bold tag.
15 var bold = document.getElementById("bold");
16 var unboldText = bold.nextSibling;
17 execSetSelectionCommand(unboldText, 0, unboldText, unboldText.textContent.length);
18 document.execCommand("insertHTML", false, "<img id='img' src='../resources/abe.png' /> not bold");
20 // Verify that the image isn't in the bold tag.
21 var image = document.getElementById("img");
22 if (image.previousSibling != bold)
23 fail("Image should be adjacent to the bold node.");
25 // Now try inserting HTML over the image.
26 execSetSelectionCommand(image, 0, image, 1);
27 document.execCommand("inserthtml", false, "<span id='red' style='color:red'>red text</span>");
29 // Verify that the red text isn't in the bold tag.
30 var red = document.getElementById("red");
31 if (red.previousSibling != bold)
32 fail("Red text should be adjacent to the bold node.");
34 // Replace text with SUCCESS.
35 document.body.innerHTML = "SUCCESS";
36 </script>