[evolution/wip/mcrha/webkit-jsc-api] Adapt h-rule tests
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/mcrha/webkit-jsc-api] Adapt h-rule tests
- Date: Wed, 11 Dec 2019 14:03:53 +0000 (UTC)
commit 753c9f1ee1be83e8bfbd7fa1d4fa01897acd08f3
Author: Milan Crha <mcrha redhat com>
Date: Wed Dec 11 15:05:09 2019 +0100
Adapt h-rule tests
data/webkit/e-editor.js | 9 +++++++--
src/e-util/test-html-editor-units.c | 10 ++++++----
2 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index a9b7e4bee5..78b7353bff 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -2222,6 +2222,13 @@ EvoEditor.UpdateThemeStyleSheet = function(css)
EvoEditor.AfterInputEvent = function(inputEvent, isWordDelim)
{
var isInsertParagraph = inputEvent.inputType == "insertParagraph";
+ var selection = document.getSelection();
+
+ if (isInsertParagraph && selection.isCollapsed && selection.baseNode && selection.baseNode.tagName ==
"BODY") {
+ document.execCommand("insertHTML", false, "<div><br></div>");
+ EvoUndoRedo.GroupTopRecords(2, "insertParagraph::withFormat");
+ return;
+ }
if ((!isInsertParagraph && inputEvent.inputType != "insertText") ||
(!(EvoEditor.MAGIC_LINKS && (isWordDelim || isInsertParagraph)) &&
@@ -2229,8 +2236,6 @@ EvoEditor.AfterInputEvent = function(inputEvent, isWordDelim)
return;
}
- var selection = document.getSelection();
-
if (!selection.isCollapsed || !selection.baseNode)
return;
diff --git a/src/e-util/test-html-editor-units.c b/src/e-util/test-html-editor-units.c
index b9eafcaca8..7e2211eda6 100644
--- a/src/e-util/test-html-editor-units.c
+++ b/src/e-util/test-html-editor-units.c
@@ -3413,8 +3413,8 @@ test_h_rule_insert (TestFixture *fixture)
"type:text\n"
"action:insert-rule\n"
"seq:^\n", /* Escape key press to close the dialog */
- HTML_PREFIX "<div>text</div><hr align=\"left\" size=\"2\" noshade=\"\">" HTML_SUFFIX,
- "text"))
+ HTML_PREFIX "<div>text</div><hr align=\"center\">" HTML_SUFFIX,
+ "text\n\n"))
g_test_fail ();
}
@@ -3428,8 +3428,10 @@ test_h_rule_insert_text_after (TestFixture *fixture)
"seq:tttttn\n" /* Move to the Close button and press it */
"seq:drn\n" /* Press the right key instead of End key as the End key won't move caret after
the HR element */
"type:below\n",
- HTML_PREFIX "<div>above</div><hr align=\"left\" size=\"2\" noshade=\"\"><div>below</div>"
HTML_SUFFIX,
- "above\nbelow"))
+ HTML_PREFIX "<div>above</div><hr align=\"center\"><div>below</div>" HTML_SUFFIX,
+ "above\n"
+ "\n"
+ "below\n"))
g_test_fail ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]