3 https://bugzilla.mozilla.org/show_bug.cgi=id=1385905
7 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
8 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
12 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1385905">Mozilla Bug
1385905</a>
13 <div id=
"display"></div>
14 <div id=
"editor" contenteditable
style=
"padding: 5px;"><div>contents
</div></div>
18 <script class=
"testbody" type=
"application/javascript">
19 SimpleTest.waitForExplicitFinish();
20 SimpleTest.waitForFocus(() =
> {
21 function ensureNoPaddingBR() {
22 for (let br of document.querySelectorAll(
"#editor > div > br")) {
23 ok(!SpecialPowers.wrap(br).isPaddingForEmptyLastLine,
24 "padding <br> element shouldn't be used with this test");
27 document.execCommand(
"defaultparagraphseparator", false,
"div");
28 var editor = document.getElementById(
"editor");
29 // Click the left blank area of the first line to set cursor to the start of
"contents".
30 synthesizeMouse(editor,
3,
10, {});
31 synthesizeKey(
"KEY_Enter");
32 is(editor.innerHTML,
"<div><br></div><div>contents</div>",
33 "Typing Enter at start of the <div> element should split the <div> element");
34 synthesizeKey(
"KEY_ArrowUp");
36 is(editor.innerHTML,
"<div>x<br></div><div>contents</div>",
37 "Typing 'x' at the empty <div> element should just insert 'x' into the <div> element");
39 synthesizeKey(
"KEY_Enter");
40 is(editor.innerHTML,
"<div>x</div><div><br></div><div>contents</div>",
41 "Typing Enter next to 'x' in the first <div> element should split the <div> element and inserts <br> element to a new <div> element");
43 synthesizeKey(
"KEY_Enter");
44 is(editor.innerHTML,
"<div>x</div><div><br></div><div><br></div><div>contents</div>",
45 "Typing Enter in the empty <div> should split the <div> element and inserts <br> element to a new <div> element");