2011-07-14 19:25:07 +04:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test for backspace key and delete key shouldn't remove another editing host's text</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="display"></div>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<script class="testbody" type="application/javascript">
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
SimpleTest.waitForFocus(runTests);
|
|
|
|
|
|
|
|
function runTests()
|
|
|
|
{
|
|
|
|
|
|
|
|
var container = document.getElementById("display");
|
|
|
|
|
|
|
|
function reset()
|
|
|
|
{
|
|
|
|
document.execCommand("Undo", false, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
var selection = window.getSelection();
|
|
|
|
function moveCaretToStartOf(aEditor)
|
|
|
|
{
|
|
|
|
selection.selectAllChildren(aEditor);
|
|
|
|
selection.collapseToStart();
|
|
|
|
}
|
|
|
|
|
|
|
|
function moveCaretToEndOf(aEditor)
|
|
|
|
{
|
|
|
|
selection.selectAllChildren(aEditor);
|
|
|
|
selection.collapseToEnd();
|
|
|
|
}
|
|
|
|
|
Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.
Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.
** About the tests **
Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.
This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
* test_htmleditor_keyevent_handling
* test_richtext2.html
One test has been clarified (no real modification):
* test_bug414526.html
Of course, a specific unit test has been added, see `test_bug677752.html'.
** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.
* 7372 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on UL
- got "<ul><li id=\"target\">ul list item</li></ul>",
expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"
* 7379 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab on UL
- got "ul list item",
expected "<ul><li id=\"target\">ul list item</li></ul>"
* 7415 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on OL -
got "<ol><li id=\"target\">ol list item</li></ol>",
expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"
* 7422 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shfit+Tab on OL
- got "ol list item",
expected "<ol><li id=\"target\">ol list item</li></ol>"
** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:
* Section A - Apply Formatting Tests: +10 points
before patch: 21/31 (Selection: 9/31)
after patch: 28/31 (Selection: 12/31)
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
* Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
before patch: 7/18 (Selection: 5/18)
after patch: 12/18 (Selection: 5/18)
IND_TEXT-1_SI editing host is modified
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 23:10:14 +04:00
|
|
|
/* TestCase #1
|
|
|
|
*/
|
2011-07-14 19:25:07 +04:00
|
|
|
const kTestCase1 =
|
|
|
|
"<p id=\"editor1\" contenteditable=\"true\">editor1</p>" +
|
|
|
|
"<p id=\"editor2\" contenteditable=\"true\">editor2</p>" +
|
|
|
|
"<div id=\"editor3\" contenteditable=\"true\"><div>editor3</div></div>" +
|
|
|
|
"<p id=\"editor4\" contenteditable=\"true\">editor4</p>" +
|
|
|
|
"non-editable text" +
|
|
|
|
"<p id=\"editor5\" contenteditable=\"true\">editor5</p>";
|
|
|
|
|
Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.
Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.
** About the tests **
Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.
This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
* test_htmleditor_keyevent_handling
* test_richtext2.html
One test has been clarified (no real modification):
* test_bug414526.html
Of course, a specific unit test has been added, see `test_bug677752.html'.
** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.
* 7372 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on UL
- got "<ul><li id=\"target\">ul list item</li></ul>",
expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"
* 7379 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab on UL
- got "ul list item",
expected "<ul><li id=\"target\">ul list item</li></ul>"
* 7415 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on OL -
got "<ol><li id=\"target\">ol list item</li></ol>",
expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"
* 7422 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shfit+Tab on OL
- got "ol list item",
expected "<ol><li id=\"target\">ol list item</li></ol>"
** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:
* Section A - Apply Formatting Tests: +10 points
before patch: 21/31 (Selection: 9/31)
after patch: 28/31 (Selection: 12/31)
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
* Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
before patch: 7/18 (Selection: 5/18)
after patch: 12/18 (Selection: 5/18)
IND_TEXT-1_SI editing host is modified
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 23:10:14 +04:00
|
|
|
const kTestCase1_editor3_deleteAtStart =
|
2011-07-14 19:25:07 +04:00
|
|
|
"<p id=\"editor1\" contenteditable=\"true\">editor1</p>" +
|
|
|
|
"<p id=\"editor2\" contenteditable=\"true\">editor2</p>" +
|
|
|
|
"<div id=\"editor3\" contenteditable=\"true\"><div>ditor3</div></div>" +
|
|
|
|
"<p id=\"editor4\" contenteditable=\"true\">editor4</p>" +
|
|
|
|
"non-editable text" +
|
|
|
|
"<p id=\"editor5\" contenteditable=\"true\">editor5</p>";
|
|
|
|
|
Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.
Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.
** About the tests **
Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.
This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
* test_htmleditor_keyevent_handling
* test_richtext2.html
One test has been clarified (no real modification):
* test_bug414526.html
Of course, a specific unit test has been added, see `test_bug677752.html'.
** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.
* 7372 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on UL
- got "<ul><li id=\"target\">ul list item</li></ul>",
expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"
* 7379 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab on UL
- got "ul list item",
expected "<ul><li id=\"target\">ul list item</li></ul>"
* 7415 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on OL -
got "<ol><li id=\"target\">ol list item</li></ol>",
expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"
* 7422 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shfit+Tab on OL
- got "ol list item",
expected "<ol><li id=\"target\">ol list item</li></ol>"
** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:
* Section A - Apply Formatting Tests: +10 points
before patch: 21/31 (Selection: 9/31)
after patch: 28/31 (Selection: 12/31)
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
* Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
before patch: 7/18 (Selection: 5/18)
after patch: 12/18 (Selection: 5/18)
IND_TEXT-1_SI editing host is modified
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 23:10:14 +04:00
|
|
|
const kTestCase1_editor3_backspaceAtEnd =
|
|
|
|
"<p id=\"editor1\" contenteditable=\"true\">editor1</p>" +
|
|
|
|
"<p id=\"editor2\" contenteditable=\"true\">editor2</p>" +
|
|
|
|
"<div id=\"editor3\" contenteditable=\"true\"><div>editor</div></div>" +
|
|
|
|
"<p id=\"editor4\" contenteditable=\"true\">editor4</p>" +
|
|
|
|
"non-editable text" +
|
|
|
|
"<p id=\"editor5\" contenteditable=\"true\">editor5</p>";
|
|
|
|
|
2011-07-14 19:25:07 +04:00
|
|
|
container.innerHTML = kTestCase1;
|
|
|
|
|
|
|
|
var editor1 = document.getElementById("editor1");
|
|
|
|
var editor2 = document.getElementById("editor2");
|
|
|
|
var editor3 = document.getElementById("editor3");
|
|
|
|
var editor4 = document.getElementById("editor4");
|
|
|
|
var editor5 = document.getElementById("editor5");
|
|
|
|
|
Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.
Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.
** About the tests **
Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.
This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
* test_htmleditor_keyevent_handling
* test_richtext2.html
One test has been clarified (no real modification):
* test_bug414526.html
Of course, a specific unit test has been added, see `test_bug677752.html'.
** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.
* 7372 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on UL
- got "<ul><li id=\"target\">ul list item</li></ul>",
expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"
* 7379 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab on UL
- got "ul list item",
expected "<ul><li id=\"target\">ul list item</li></ul>"
* 7415 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on OL -
got "<ol><li id=\"target\">ol list item</li></ol>",
expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"
* 7422 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shfit+Tab on OL
- got "ol list item",
expected "<ol><li id=\"target\">ol list item</li></ol>"
** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:
* Section A - Apply Formatting Tests: +10 points
before patch: 21/31 (Selection: 9/31)
after patch: 28/31 (Selection: 12/31)
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
* Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
before patch: 7/18 (Selection: 5/18)
after patch: 12/18 (Selection: 5/18)
IND_TEXT-1_SI editing host is modified
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 23:10:14 +04:00
|
|
|
/* TestCase #1:
|
|
|
|
* pressing backspace key at start should not change the content.
|
|
|
|
*/
|
2011-07-14 19:25:07 +04:00
|
|
|
editor2.focus();
|
|
|
|
moveCaretToStartOf(editor2);
|
|
|
|
synthesizeKey("VK_BACK_SPACE", { });
|
|
|
|
is(container.innerHTML, kTestCase1,
|
|
|
|
"Pressing backspace key at start of editor2 changes the content");
|
|
|
|
reset();
|
|
|
|
|
|
|
|
editor3.focus();
|
|
|
|
moveCaretToStartOf(editor3);
|
|
|
|
synthesizeKey("VK_BACK_SPACE", { });
|
|
|
|
is(container.innerHTML, kTestCase1,
|
|
|
|
"Pressing backspace key at start of editor3 changes the content");
|
|
|
|
reset();
|
|
|
|
|
|
|
|
editor4.focus();
|
|
|
|
moveCaretToStartOf(editor4);
|
|
|
|
synthesizeKey("VK_BACK_SPACE", { });
|
|
|
|
is(container.innerHTML, kTestCase1,
|
|
|
|
"Pressing backspace key at start of editor4 changes the content");
|
|
|
|
reset();
|
|
|
|
|
|
|
|
editor5.focus();
|
|
|
|
moveCaretToStartOf(editor5);
|
|
|
|
synthesizeKey("VK_BACK_SPACE", { });
|
|
|
|
is(container.innerHTML, kTestCase1,
|
|
|
|
"Pressing backspace key at start of editor5 changes the content");
|
|
|
|
reset();
|
|
|
|
|
Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.
Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.
** About the tests **
Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.
This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
* test_htmleditor_keyevent_handling
* test_richtext2.html
One test has been clarified (no real modification):
* test_bug414526.html
Of course, a specific unit test has been added, see `test_bug677752.html'.
** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.
* 7372 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on UL
- got "<ul><li id=\"target\">ul list item</li></ul>",
expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"
* 7379 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab on UL
- got "ul list item",
expected "<ul><li id=\"target\">ul list item</li></ul>"
* 7415 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on OL -
got "<ol><li id=\"target\">ol list item</li></ol>",
expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"
* 7422 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shfit+Tab on OL
- got "ol list item",
expected "<ol><li id=\"target\">ol list item</li></ol>"
** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:
* Section A - Apply Formatting Tests: +10 points
before patch: 21/31 (Selection: 9/31)
after patch: 28/31 (Selection: 12/31)
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
* Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
before patch: 7/18 (Selection: 5/18)
after patch: 12/18 (Selection: 5/18)
IND_TEXT-1_SI editing host is modified
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 23:10:14 +04:00
|
|
|
/* TestCase #1:
|
|
|
|
* pressing delete key at end should not change the content.
|
|
|
|
*/
|
2011-07-14 19:25:07 +04:00
|
|
|
editor1.focus();
|
|
|
|
moveCaretToEndOf(editor1);
|
|
|
|
synthesizeKey("VK_DELETE", { });
|
|
|
|
is(container.innerHTML, kTestCase1,
|
|
|
|
"Pressing delete key at end of editor1 changes the content");
|
|
|
|
reset();
|
|
|
|
|
|
|
|
editor2.focus();
|
|
|
|
moveCaretToEndOf(editor2);
|
|
|
|
synthesizeKey("VK_DELETE", { });
|
|
|
|
is(container.innerHTML, kTestCase1,
|
|
|
|
"Pressing delete key at end of editor2 changes the content");
|
|
|
|
reset();
|
|
|
|
|
|
|
|
editor3.focus();
|
|
|
|
moveCaretToEndOf(editor3);
|
|
|
|
synthesizeKey("VK_DELETE", { });
|
2015-03-24 08:17:00 +03:00
|
|
|
is(container.innerHTML, kTestCase1,
|
2011-07-14 19:25:07 +04:00
|
|
|
"Pressing delete key at end of editor3 changes the content");
|
|
|
|
reset();
|
|
|
|
|
|
|
|
editor4.focus();
|
|
|
|
moveCaretToEndOf(editor4);
|
|
|
|
synthesizeKey("VK_DELETE", { });
|
|
|
|
is(container.innerHTML, kTestCase1,
|
|
|
|
"Pressing delete key at end of editor4 changes the content");
|
|
|
|
reset();
|
|
|
|
|
Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.
Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.
** About the tests **
Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.
This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
* test_htmleditor_keyevent_handling
* test_richtext2.html
One test has been clarified (no real modification):
* test_bug414526.html
Of course, a specific unit test has been added, see `test_bug677752.html'.
** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.
* 7372 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on UL
- got "<ul><li id=\"target\">ul list item</li></ul>",
expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"
* 7379 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab on UL
- got "ul list item",
expected "<ul><li id=\"target\">ul list item</li></ul>"
* 7415 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on OL -
got "<ol><li id=\"target\">ol list item</li></ol>",
expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"
* 7422 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shfit+Tab on OL
- got "ol list item",
expected "<ol><li id=\"target\">ol list item</li></ol>"
** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:
* Section A - Apply Formatting Tests: +10 points
before patch: 21/31 (Selection: 9/31)
after patch: 28/31 (Selection: 12/31)
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
* Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
before patch: 7/18 (Selection: 5/18)
after patch: 12/18 (Selection: 5/18)
IND_TEXT-1_SI editing host is modified
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 23:10:14 +04:00
|
|
|
/* TestCase #1: cases when the caret is not on text node.
|
|
|
|
* - pressing delete key at start should remove the first character
|
|
|
|
* - pressing backspace key at end should remove the first character
|
|
|
|
* and the adjacent blocks should not be changed.
|
|
|
|
*/
|
2011-07-14 19:25:07 +04:00
|
|
|
editor3.focus();
|
|
|
|
moveCaretToStartOf(editor3);
|
|
|
|
synthesizeKey("VK_DELETE", { });
|
Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.
Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.
** About the tests **
Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.
This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
* test_htmleditor_keyevent_handling
* test_richtext2.html
One test has been clarified (no real modification):
* test_bug414526.html
Of course, a specific unit test has been added, see `test_bug677752.html'.
** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.
* 7372 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on UL
- got "<ul><li id=\"target\">ul list item</li></ul>",
expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"
* 7379 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab on UL
- got "ul list item",
expected "<ul><li id=\"target\">ul list item</li></ul>"
* 7415 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on OL -
got "<ol><li id=\"target\">ol list item</li></ol>",
expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"
* 7422 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shfit+Tab on OL
- got "ol list item",
expected "<ol><li id=\"target\">ol list item</li></ol>"
** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:
* Section A - Apply Formatting Tests: +10 points
before patch: 21/31 (Selection: 9/31)
after patch: 28/31 (Selection: 12/31)
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
* Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
before patch: 7/18 (Selection: 5/18)
after patch: 12/18 (Selection: 5/18)
IND_TEXT-1_SI editing host is modified
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 23:10:14 +04:00
|
|
|
is(container.innerHTML, kTestCase1_editor3_deleteAtStart,
|
|
|
|
"Pressing delete key at start of editor3 changes adjacent elements"
|
|
|
|
+ " and/or does not remove the first character.");
|
2011-07-14 19:25:07 +04:00
|
|
|
reset();
|
|
|
|
|
Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.
Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.
** About the tests **
Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.
This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
* test_htmleditor_keyevent_handling
* test_richtext2.html
One test has been clarified (no real modification):
* test_bug414526.html
Of course, a specific unit test has been added, see `test_bug677752.html'.
** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.
* 7372 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on UL
- got "<ul><li id=\"target\">ul list item</li></ul>",
expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"
* 7379 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab on UL
- got "ul list item",
expected "<ul><li id=\"target\">ul list item</li></ul>"
* 7415 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on OL -
got "<ol><li id=\"target\">ol list item</li></ol>",
expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"
* 7422 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shfit+Tab on OL
- got "ol list item",
expected "<ol><li id=\"target\">ol list item</li></ol>"
** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:
* Section A - Apply Formatting Tests: +10 points
before patch: 21/31 (Selection: 9/31)
after patch: 28/31 (Selection: 12/31)
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
* Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
before patch: 7/18 (Selection: 5/18)
after patch: 12/18 (Selection: 5/18)
IND_TEXT-1_SI editing host is modified
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 23:10:14 +04:00
|
|
|
// Backspace doesn't work here yet.
|
|
|
|
editor3.focus();
|
|
|
|
moveCaretToEndOf(editor3);
|
|
|
|
synthesizeKey("VK_BACK_SPACE", { });
|
|
|
|
todo_is(container.innerHTML, kTestCase1_editor3_backspaceAtEnd,
|
|
|
|
"Pressing backspace key at end of editor3 changes adjacent elements"
|
|
|
|
+ " and/or does not remove the last character.");
|
|
|
|
reset();
|
|
|
|
// We can still check that adjacent elements are not affected.
|
2011-07-14 19:25:07 +04:00
|
|
|
editor3.focus();
|
|
|
|
moveCaretToEndOf(editor3);
|
|
|
|
synthesizeKey("VK_BACK_SPACE", { });
|
|
|
|
is(container.innerHTML, kTestCase1,
|
|
|
|
"Pressing backspace key at end of editor3 changes the content");
|
|
|
|
reset();
|
|
|
|
|
Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.
Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.
** About the tests **
Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.
This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
* test_htmleditor_keyevent_handling
* test_richtext2.html
One test has been clarified (no real modification):
* test_bug414526.html
Of course, a specific unit test has been added, see `test_bug677752.html'.
** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.
* 7372 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on UL
- got "<ul><li id=\"target\">ul list item</li></ul>",
expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"
* 7379 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab on UL
- got "ul list item",
expected "<ul><li id=\"target\">ul list item</li></ul>"
* 7415 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on OL -
got "<ol><li id=\"target\">ol list item</li></ol>",
expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"
* 7422 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shfit+Tab on OL
- got "ol list item",
expected "<ol><li id=\"target\">ol list item</li></ol>"
** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:
* Section A - Apply Formatting Tests: +10 points
before patch: 21/31 (Selection: 9/31)
after patch: 28/31 (Selection: 12/31)
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
* Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
before patch: 7/18 (Selection: 5/18)
after patch: 12/18 (Selection: 5/18)
IND_TEXT-1_SI editing host is modified
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 23:10:14 +04:00
|
|
|
/* TestCase #2:
|
|
|
|
* two adjacent editable <span> in a table cell.
|
|
|
|
*/
|
2011-07-14 19:25:07 +04:00
|
|
|
const kTestCase2 = "<table><tbody><tr><td><span id=\"editor1\" contenteditable=\"true\">test</span>" +
|
|
|
|
"<span id=\"editor2\" contenteditable=\"true\">test</span></td></tr></tbody></table>";
|
|
|
|
|
|
|
|
container.innerHTML = kTestCase2;
|
|
|
|
editor1 = document.getElementById("editor1");
|
|
|
|
editor2 = document.getElementById("editor2");
|
|
|
|
|
|
|
|
editor2.focus();
|
|
|
|
moveCaretToStartOf(editor2);
|
|
|
|
synthesizeKey("VK_BACK_SPACE", { });
|
|
|
|
is(container.innerHTML, kTestCase2,
|
|
|
|
"Pressing backspace key at the start of editor2 changes the content for kTestCase2");
|
|
|
|
reset();
|
|
|
|
|
|
|
|
editor1.focus();
|
|
|
|
moveCaretToEndOf(editor1);
|
|
|
|
synthesizeKey("VK_DELETE", { });
|
|
|
|
is(container.innerHTML, kTestCase2,
|
|
|
|
"Pressing delete key at the end of editor1 changes the content for kTestCase2");
|
|
|
|
reset();
|
|
|
|
|
Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.
Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.
** About the tests **
Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.
This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
* test_htmleditor_keyevent_handling
* test_richtext2.html
One test has been clarified (no real modification):
* test_bug414526.html
Of course, a specific unit test has been added, see `test_bug677752.html'.
** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.
* 7372 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on UL
- got "<ul><li id=\"target\">ul list item</li></ul>",
expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"
* 7379 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab on UL
- got "ul list item",
expected "<ul><li id=\"target\">ul list item</li></ul>"
* 7415 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on OL -
got "<ol><li id=\"target\">ol list item</li></ol>",
expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"
* 7422 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shfit+Tab on OL
- got "ol list item",
expected "<ol><li id=\"target\">ol list item</li></ol>"
** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:
* Section A - Apply Formatting Tests: +10 points
before patch: 21/31 (Selection: 9/31)
after patch: 28/31 (Selection: 12/31)
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
* Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
before patch: 7/18 (Selection: 5/18)
after patch: 12/18 (Selection: 5/18)
IND_TEXT-1_SI editing host is modified
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 23:10:14 +04:00
|
|
|
/* TestCase #3:
|
|
|
|
* editable <span> in two adjacent table cells.
|
|
|
|
*/
|
2011-07-14 19:25:07 +04:00
|
|
|
const kTestCase3 = "<table><tbody><tr><td><span id=\"editor1\" contenteditable=\"true\">test</span></td>" +
|
|
|
|
"<td><span id=\"editor2\" contenteditable=\"true\">test</span></td></tr></tbody></table>";
|
|
|
|
|
|
|
|
container.innerHTML = kTestCase3;
|
|
|
|
editor1 = document.getElementById("editor1");
|
|
|
|
editor2 = document.getElementById("editor2");
|
|
|
|
|
|
|
|
editor2.focus();
|
|
|
|
moveCaretToStartOf(editor2);
|
|
|
|
synthesizeKey("VK_BACK_SPACE", { });
|
|
|
|
is(container.innerHTML, kTestCase3,
|
|
|
|
"Pressing backspace key at the start of editor2 changes the content for kTestCase3");
|
|
|
|
reset();
|
|
|
|
|
|
|
|
editor1.focus();
|
|
|
|
moveCaretToEndOf(editor1);
|
|
|
|
synthesizeKey("VK_DELETE", { });
|
|
|
|
is(container.innerHTML, kTestCase3,
|
|
|
|
"Pressing delete key at the end of editor1 changes the content for kTestCase3");
|
|
|
|
reset();
|
|
|
|
|
Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.
Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.
** About the tests **
Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.
This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
* test_htmleditor_keyevent_handling
* test_richtext2.html
One test has been clarified (no real modification):
* test_bug414526.html
Of course, a specific unit test has been added, see `test_bug677752.html'.
** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.
* 7372 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on UL
- got "<ul><li id=\"target\">ul list item</li></ul>",
expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"
* 7379 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab on UL
- got "ul list item",
expected "<ul><li id=\"target\">ul list item</li></ul>"
* 7415 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shift+Tab after Tab on OL -
got "<ol><li id=\"target\">ol list item</li></ol>",
expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"
* 7422 ERROR TEST-UNEXPECTED-FAIL
| non-tabbable HTML editor: Shfit+Tab on OL
- got "ol list item",
expected "<ol><li id=\"target\">ol list item</li></ol>"
** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:
* Section A - Apply Formatting Tests: +10 points
before patch: 21/31 (Selection: 9/31)
after patch: 28/31 (Selection: 12/31)
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_TEXT-1_SI EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
FB:BQ_BR.BR-1_SM EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
IND_TEXT-1_SI EXECUTION EXCEPTION
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
* Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
before patch: 7/18 (Selection: 5/18)
after patch: 12/18 (Selection: 5/18)
IND_TEXT-1_SI editing host is modified
JC_TEXT-1_SC editing host is modified
JF_TEXT-1_SC editing host is modified
JL_TEXT-1_SC editing host is modified
JR_TEXT-1_SC editing host is modified
** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 23:10:14 +04:00
|
|
|
/* TestCase #4:
|
|
|
|
* editable <div> in two adjacent table cells.
|
|
|
|
*/
|
2011-07-14 19:25:07 +04:00
|
|
|
const kTestCase4 = "<table><tbody><tr><td><div id=\"editor1\" contenteditable=\"true\">test</div></td>" +
|
|
|
|
"<td><div id=\"editor2\" contenteditable=\"true\">test</div></td></tr></tbody></table>";
|
|
|
|
|
|
|
|
container.innerHTML = kTestCase4;
|
|
|
|
editor1 = document.getElementById("editor1");
|
|
|
|
editor2 = document.getElementById("editor2");
|
|
|
|
|
|
|
|
editor2.focus();
|
|
|
|
moveCaretToStartOf(editor2);
|
|
|
|
synthesizeKey("VK_BACK_SPACE", { });
|
|
|
|
is(container.innerHTML, kTestCase4,
|
|
|
|
"Pressing backspace key at the start of editor2 changes the content for kTestCase4");
|
|
|
|
reset();
|
|
|
|
|
|
|
|
editor1.focus();
|
|
|
|
moveCaretToEndOf(editor1);
|
|
|
|
synthesizeKey("VK_DELETE", { });
|
|
|
|
is(container.innerHTML, kTestCase4,
|
|
|
|
"Pressing delete key at the end of editor1 changes the content for kTestCase4");
|
|
|
|
reset();
|
|
|
|
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|