Bug 1310912 - Part 6. Add redo test. r=masayuki

MozReview-Commit-ID: 5TgGAq3tM01

--HG--
extra : rebase_source : 031c1687887b67892ac4c9569fe843c17d5b1a49
extra : histedit_source : 3006cca58c3c5736ab603f3088296272db9763ed
This commit is contained in:
Makoto Kato 2016-11-10 21:17:34 +09:00
Родитель b2b4afaf31
Коммит 74fe2d5fc8
1 изменённых файлов: 7 добавлений и 5 удалений

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

@ -24,11 +24,6 @@ SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
let elm = document.getElementById("editable1");
elm.addEventListener("input", () => {
let range = window.getSelection().getRangeAt(0);
range.insertNode(document.createTextNode(""));
});
elm.focus();
let sel = window.getSelection();
sel.collapse(elm.childNodes[0], elm.textContent.length);
@ -44,6 +39,7 @@ SimpleTest.waitForFocus(function() {
});
ok(elm.textContent == "ABCDEF", "composing text should be set");
window.getSelection().getRangeAt(0).insertNode(document.createTextNode(""));
synthesizeCompositionChange({
composition: {
string: "GHI",
@ -55,6 +51,7 @@ SimpleTest.waitForFocus(function() {
});
ok(elm.textContent == "ABCGHI", "composing text should be replaced");
window.getSelection().getRangeAt(0).insertNode(document.createTextNode(""));
synthesizeCompositionChange({
composition: {
string: "JKL",
@ -66,6 +63,7 @@ SimpleTest.waitForFocus(function() {
});
ok(elm.textContent == "ABCJKL", "composing text should be replaced");
window.getSelection().getRangeAt(0).insertNode(document.createTextNode(""));
synthesizeCompositionChange({
composition: {
string: "MNO",
@ -77,12 +75,16 @@ SimpleTest.waitForFocus(function() {
});
ok(elm.textContent == "ABCMNO", "composing text should be replaced");
window.getSelection().getRangeAt(0).insertNode(document.createTextNode(""));
synthesizeComposition({ type: "compositioncommitasis" });
ok(elm.textContent == "ABCMNO", "composing text should be committed");
synthesizeKey("Z", { accelKey: true });
ok(elm.textContent == "ABC", "text should be undoed");
synthesizeKey("Z", { accelKey: true, shiftKey: true });
ok(elm.textContent == "ABCMNO", "text should be redoed");
SimpleTest.finish();
});
</script>