Bug 850043 - Part 2. Add test. r=masayuki

MozReview-Commit-ID: 9iY6udNCQdL

--HG--
extra : rebase_source : 4d9ec835c619afa2fc2b8157118e31ee5ab9e0d0
This commit is contained in:
Makoto Kato 2016-10-17 14:24:47 +09:00
Родитель d4e1205058
Коммит 167407b34f
2 изменённых файлов: 65 добавлений и 0 удалений

Просмотреть файл

@ -147,6 +147,7 @@ subsuite = clipboard
[test_bug795785.html] [test_bug795785.html]
[test_bug796839.html] [test_bug796839.html]
[test_bug832025.html] [test_bug832025.html]
[test_bug850043.html]
[test_bug857487.html] [test_bug857487.html]
[test_bug858918.html] [test_bug858918.html]
[test_bug915962.html] [test_bug915962.html]

Просмотреть файл

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=850043
-->
<head>
<title>Test for Bug 850043</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=850043">Mozilla Bug 850043</a>
<div id="display">
<textarea id="textarea">b&#x9080;&#xe010f;&#x8fba;&#xe0101;</textarea>
<div contenteditable id="edit">b&#x9080;&#xe010f;&#x8fba;&#xe0101;</div>
</div>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
<script>
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(() => {
let fm = SpecialPowers.Cc["@mozilla.org/focus-manager;1"].
getService(SpecialPowers.Ci.nsIFocusManager);
let element = document.getElementById("textarea");
element.focus();
is(SpecialPowers.unwrap(fm.focusedElement), element, "failed to move focus");
synthesizeKey("VK_END", { });
synthesizeKey("a", { });
is(element.value, "b\u{9080}\u{e010f}\u{8fba}\u{e0101}a", "a isn't last character");
synthesizeKey("VK_BACK_SPACE", { });
synthesizeKey("VK_BACK_SPACE", { });
synthesizeKey("VK_BACK_SPACE", { });
is(element.value, 'b', "cannot remove all IVS characters");
element = document.getElementById("edit");
element.focus();
is(SpecialPowers.unwrap(fm.focusedElement), element, "failed to move focus");
let sel = window.getSelection();
sel.collapse(element.childNodes[0], element.textContent.length);
synthesizeKey("a", { });
is(element.textContent, "b\u{9080}\u{e010f}\u{8fba}\u{e0101}a", "a isn't last character");
synthesizeKey("VK_BACK_SPACE", { });
synthesizeKey("VK_BACK_SPACE", { });
synthesizeKey("VK_BACK_SPACE", { });
is(element.textContent, 'b', "cannot remove all IVS characters");
SimpleTest.finish();
});
</script>
</body>
</html>