Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / inserting / paragraph-outside-nested-divs.html
blob8239a943e270fe1c007ed4296ff7b9e1e2c23148
1 <body contentEditable="true">
2 <p>When inserting a new line, we should break out of nested divs.</p>
3 <p id="results"><p>
4 <div>first<div>second</div><div>third</div></div>
5 </body>
6 <script src="../editing.js"></script>
7 <script>
8 if (window.testRunner)
9 window.testRunner.dumpAsText();
10 if (window.internals)
11 internals.settings.setEditingBehavior("mac");
12 function fail(msg) {
13 document.getElementById("results").innerText = "FAIL";
14 throw msg;
17 // Try inserting a new line after the last div.
18 var div2 = document.getElementsByTagName("div")[1];
19 var div3 = document.getElementsByTagName("div")[2];
20 execSetSelectionCommand(div3, 0, div3, 0);
21 execMoveSelectionForwardByWordCommand();
23 execTypeCharacterCommand("\n");
24 execInsertHTMLCommand("This should be in a single div.");
26 var div4 = document.getElementsByTagName("div")[3];
27 if (div4.innerHTML != "This should be in a single div.")
28 fail("wrong div4? " + div4.innerHTML);
29 if (div4.parentNode.tagName != "BODY")
30 fail("div should not be nested: " + div4.parentNode.tagName);
32 // Try inserting a new line after the second div. This should be nested.
33 execSetSelectionCommand(div2, 0, div2, 0);
34 execMoveSelectionForwardByWordCommand();
36 execTypeCharacterCommand("\n");
37 execInsertHTMLCommand("This should be in nested divs.");
39 var nestedDiv = document.getElementsByTagName("div")[2];
40 if (nestedDiv.innerHTML != "This should be in nested divs.")
41 fail("wrong nestedDiv? " + nestedDiv.innerHTML);
42 if (nestedDiv.parentNode.tagName != "DIV")
43 fail("div should be nested: " + nestedDiv.parentNode.tagName);
45 document.getElementById("results").innerText = "SUCCESS";
46 </script>