gecko/editor/libeditor/html/tests/test_bug332636.html
Ehsan Akhgari 67c7d5d5e2 Bug 332636 - Handle backspace for Unicode plane 1 characters correctly; r=roc
--HG--
extra : rebase_source : a343610b06983d3328f3ddb2e7025193ab275094
2010-06-04 13:28:19 -04:00

46 lines
1.3 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=332636
-->
<head>
<title>Test for Bug 332636</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332636">Mozilla Bug 332636</a>
<p id="display"></p>
<div id="content">
<div id="edit" contenteditable="true">a𐐀b</div>
<div id="edit2" contenteditable="true">a&#x10a0f;b</div>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 332636 **/
SimpleTest.waitForExplicitFinish();
addLoadEvent(runTest);
function test(edit) {
edit.focus();
var sel = window.getSelection();
sel.collapse(edit.childNodes[0], edit.textContent.length - 1);
synthesizeKey("VK_BACK_SPACE", {});
is(edit.textContent, "ab", "The backspace key should delete the UTF-16 surrogate pair correctly");
}
function runTest() {
test(document.getElementById("edit"));
test(document.getElementById("edit2"));
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>