Bug 502259. Make delete at end of paragraph work. r=cpearce

This commit is contained in:
liucougar@gmail.com 2009-08-04 09:46:48 +12:00
Родитель c3c28a472b
Коммит b8bff67c98
2 изменённых файлов: 11 добавлений и 4 удалений

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

@ -683,7 +683,7 @@ nsPlaintextEditor::ExtendSelectionForDelete(nsISelection *aSelection,
break;
case eNext:
result = selCont->CharacterExtendForDelete();
*aAction = eNone;
// Don't set aAction to eNone (see Bug 502259)
break;
case ePrevious:
/* FIXME: extend selection over UTF-16 surrogates for Bug #332636

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

@ -76,12 +76,15 @@ function execTests() {
is(selRange.endOffset, endOffset, selErrString("Word right"));
}
function testDelete(node, offset, text) {
function testDelete(node, offset, text, richtext) {
doCommand("cmd_deleteCharForward");
var msg = "Delete broken in \"" + editor.innerHTML + "\", offset " + offset;
if(typeof node == 'function'){
node = node();
}
is(sel.anchorNode, node, msg);
is(sel.anchorOffset, offset, msg);
is(editor.textContent, text, msg);
is(richtext?editor.innerHTML:editor.textContent, text, msg);
}
function testBackspace(node, offset, text) {
@ -177,7 +180,7 @@ function execTests() {
// Tests for Bug 419217
setupTest("foo<div>bar</div>", 3);
testDelete(editor.firstChild, 3, "foobar");
testDelete(function(){return editor.firstChild;}, 3, "foobar", true);
// Tests for Bug 419406
var s = "helloשלום";
@ -202,6 +205,10 @@ function execTests() {
testDeleteNextWord(editor.firstChild, 0, "\u00A0text.");
// testDeleteNextWord(editor, 0, "");
// Tests for Bug 502259
setupTest("<p>Bug</p>\n<p>502259</p>", 1);
testDelete(function(){return editor.firstChild.firstChild;}, 3, "<p>Bug502259</p>", true);
SimpleTest.finish();
}