4 https://bugzilla.mozilla.org/show_bug.cgi?id=332636
7 <title>Test for Bug
332636</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
10 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=332636">Mozilla Bug
332636</a>
16 <div id=
"edit0" contenteditable=
"true">axb
</div><!-- reference: plane 0 base character -->
17 <div id=
"edit1" contenteditable=
"true">a
̈b
</div><!-- reference: plane 0 diacritic -->
18 <div id=
"edit2" contenteditable=
"true">a
𐐀b
</div><!-- plane 1 base character -->
19 <div id=
"edit3" contenteditable=
"true">a
𐨏b
</div><!-- plane 1 diacritic -->
21 <div id=
"edit0b" contenteditable=
"true">axb
</div><!-- reference: plane 0 base character -->
22 <div id=
"edit1b" contenteditable=
"true">a
̈b
</div><!-- reference: plane 0 diacritic -->
23 <div id=
"edit2b" contenteditable=
"true">a
𐐀b
</div><!-- plane 1 base character -->
24 <div id=
"edit3b" contenteditable=
"true">a
𐨏b
</div><!-- plane 1 diacritic -->
27 <script type=
"application/javascript">
29 /** Test for Bug
332636 **/
31 SimpleTest.waitForExplicitFinish();
32 addLoadEvent(runTest);
36 var sel = window.getSelection();
37 sel.collapse(edit.childNodes[
0], edit.textContent.length -
1);
38 synthesizeKey(
"KEY_Backspace");
39 is(edit.textContent,
"ab",
"The backspace key should delete the UTF-16 surrogate pair correctly");
42 function testWithMove(edit, offset) {
44 var sel = window.getSelection();
45 sel.collapse(edit.childNodes[
0],
0);
47 for (i =
0; i < offset; ++i) {
48 synthesizeKey(
"KEY_ArrowRight");
49 synthesizeKey(
"KEY_ArrowLeft");
50 synthesizeKey(
"KEY_ArrowRight");
52 synthesizeKey(
"KEY_Backspace");
53 is(edit.textContent,
"ab",
"The backspace key should delete the UTF-16 surrogate pair correctly");
57 /* test backspace-deletion of the middle character */
58 test(document.getElementById(
"edit0"));
59 test(document.getElementById(
"edit1"));
60 test(document.getElementById(
"edit2"));
61 test(document.getElementById(
"edit3"));
63 /* extra tests with the use of RIGHT and LEFT to get to the right place */
64 testWithMove(document.getElementById(
"edit0b"),
2);
65 testWithMove(document.getElementById(
"edit1b"),
1);
66 testWithMove(document.getElementById(
"edit2b"),
2);
67 testWithMove(document.getElementById(
"edit3b"),
1);