[evolution/wip/webkit2] Add another list test that tests the change of the list to another type of list
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Add another list test that tests the change of the list to another type of list
- Date: Tue, 19 Jul 2016 14:17:28 +0000 (UTC)
commit 68f3cdde71d2ae54b361e27fa4a998a516ec0247
Author: Tomas Popela <tpopela redhat com>
Date: Tue Jul 19 15:38:49 2016 +0200
Add another list test that tests the change of the list to another type of list
e-util/test-html-editor-units.c | 36 ++++++++++++++++++-
.../web-extension/e-editor-dom-functions.c | 10 +++---
2 files changed, 39 insertions(+), 7 deletions(-)
---
diff --git a/e-util/test-html-editor-units.c b/e-util/test-html-editor-units.c
index 798f8d9..43b832e 100644
--- a/e-util/test-html-editor-units.c
+++ b/e-util/test-html-editor-units.c
@@ -452,8 +452,8 @@ test_list_multi_html (TestFixture *fixture)
"type:item 4\\n\n",
HTML_PREFIX
"<ul>"
- "<li>item 1</li>"
- "<li>item 2</li>"
+ "<li>item 1</li>"
+ "<li>item 2</li>"
"</ul>"
"<ol type=\"I\">"
"<li>item 3</li>"
@@ -469,6 +469,37 @@ test_list_multi_html (TestFixture *fixture)
g_test_fail ();
}
+static void
+test_list_multi_change_html (TestFixture *fixture)
+{
+ if (!test_utils_run_simple_test (fixture,
+ "mode:html\n"
+ "action:style-list-bullet\n"
+ "type:item 1\\n\n"
+ "type:item 2\\n\n"
+ "type:\\n\n"
+ "action:style-list-roman\n"
+ "type:item 3\\n\n"
+ "type:item 4\\n\n"
+ "action:select-all\n"
+ "action:style-list-number\n",
+ HTML_PREFIX
+ "<ol>"
+ "<li>item 1</li>"
+ "<li>item 2</li>"
+ "<li>item 3</li>"
+ "<li>item 4</li>"
+ "<li><br></li>"
+ "</ol>"
+ HTML_SUFFIX,
+ " 1. item 1\n"
+ " 2. item 2\n"
+ " 3. item 3\n"
+ " 4. item 4\n"
+ " 5. "))
+ g_test_fail ();
+}
+
gint
main (gint argc,
gchar *argv[])
@@ -543,6 +574,7 @@ main (gint argc,
add_test ("/list/alpha/html", test_list_alpha_html);
add_test ("/list/roman/plain", test_list_roman_plain);
add_test ("/list/multi/html", test_list_multi_html);
+ add_test ("/list/multi/change/html", test_list_multi_change_html);
#undef add_test
diff --git a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index a38314f..0df5914 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -16608,6 +16608,7 @@ format_change_list_from_list (EEditorPage *editor_page,
if (selection_end) {
source_list_clone = webkit_dom_node_clone_node_with_error (current_list, FALSE, NULL);
+ remove_node_if_empty (current_list);
after_selection_end = TRUE;
}
@@ -16641,13 +16642,12 @@ format_change_list_from_list (EEditorPage *editor_page,
webkit_dom_node_insert_before (
webkit_dom_node_get_parent_node (source_list_clone),
WEBKIT_DOM_NODE (new_list),
- source_list_clone, NULL);
+ source_list_clone,
+ NULL);
- if (!webkit_dom_node_has_child_nodes (source_list))
- remove_node (source_list);
+ remove_node_if_empty (source_list);
- if (!webkit_dom_node_has_child_nodes (source_list_clone))
- remove_node (source_list_clone);
+ remove_node_if_empty (source_list_clone);
merge_lists_if_possible (WEBKIT_DOM_NODE (new_list));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]