2 <?xml-stylesheet href=
"chrome://global/skin"
4 <?xml-stylesheet href=
"chrome://mochikit/content/tests/SimpleTest/test.css"
7 https://bugzilla.mozilla.org/show_bug.cgi?id=1397412
9 <window xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
10 title=
"Mozilla Bug 1397412" onload=
"runTest();">
11 <script src=
"chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
12 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
14 <body xmlns=
"http://www.w3.org/1999/xhtml">
15 <a href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1397412"
16 target=
"_blank">Mozilla Bug
1397412</a>
18 <editor xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
22 style=
"width: 400px; height: 200px;"/>
27 <script class=
"testbody" type=
"application/javascript">
30 var initialHTML1 =
"xx<br><br>";
31 var expectedHTML1 =
"xx<br>t<br>";
32 var initialHTML2 =
"xx<br><br>yy<br>";
33 var expectedHTML2 =
"xx<br>t<br>yy<br>";
36 .QueryInterface(Ci.nsIDocShell)
37 .appType = Ci.nsIDocShell.APP_TYPE_EDITOR;
38 var e = document.getElementById(
"editor");
39 var doc = e.contentDocument;
40 doc.designMode =
"on";
41 doc.defaultView.focus();
42 var selection = doc.defaultView.getSelection();
46 body.innerHTML = initialHTML1;
47 selection.collapse(body,
2);
49 var actualHTML = body.innerHTML;
50 is(actualHTML, expectedHTML1,
"'t' should be inserted between <br>s");
53 body.innerHTML = initialHTML2;
54 selection.collapse(body,
2);
56 actualHTML = body.innerHTML;
57 is(actualHTML, expectedHTML2,
"'t' should be inserted between <br>s");
62 SimpleTest.waitForExplicitFinish();