|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=607584 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 607584</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 </head> |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=607584">Mozilla Bug 607584</a> |
|
14 <p id="display"></p> |
|
15 <div id="content" contenteditable> |
|
16 <p id="foo">Hello world</p> |
|
17 </div> |
|
18 <pre id="test"> |
|
19 <script type="application/javascript"> |
|
20 |
|
21 /** Test for Bug 607584 **/ |
|
22 SimpleTest.waitForExplicitFinish(); |
|
23 SimpleTest.waitForFocus(function() { |
|
24 var content = document.getElementById("content"); |
|
25 content.focus(); |
|
26 var sel = getSelection(); |
|
27 sel.collapse(document.getElementById("foo").firstChild, 5); |
|
28 synthesizeKey("VK_RETURN", {}); |
|
29 var paragraphs = content.querySelectorAll("p"); |
|
30 is(paragraphs.length, 2, "The paragraph should be split in two"); |
|
31 is(paragraphs[0].textContent, "Hello", "The first paragraph should have the correct content"); |
|
32 is(paragraphs[1].textContent, " world", "The second paragraph should have the correct content"); |
|
33 is(paragraphs[0].getAttribute("id"), "foo", "The id of the first paragraph should be retained"); |
|
34 is(paragraphs[1].hasAttribute("id"), false, "The second paragraph shouldn't have an ID"); |
|
35 SimpleTest.finish(); |
|
36 }); |
|
37 |
|
38 </script> |
|
39 </pre> |
|
40 </body> |
|
41 </html> |