From 74fe2d5fc8d139ed8c0ef785104e32faabc4f1f7 Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Thu, 10 Nov 2016 21:17:34 +0900 Subject: [PATCH] Bug 1310912 - Part 6. Add redo test. r=masayuki MozReview-Commit-ID: 5TgGAq3tM01 --HG-- extra : rebase_source : 031c1687887b67892ac4c9569fe843c17d5b1a49 extra : histedit_source : 3006cca58c3c5736ab603f3088296272db9763ed --- editor/libeditor/tests/test_bug1310912.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/editor/libeditor/tests/test_bug1310912.html b/editor/libeditor/tests/test_bug1310912.html index 7d8822279106..d73366a6351f 100644 --- a/editor/libeditor/tests/test_bug1310912.html +++ b/editor/libeditor/tests/test_bug1310912.html @@ -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(); });