From 3b38503bf421b2de7ded85cfbdee82bb5e0cf0ba Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Mon, 13 Aug 2018 15:31:56 +0900 Subject: [PATCH] Bug 1482019 - part 0: Add automated tests for nsIHTMLEditor.getSelectedElement() r=m_kato The HTMLEditor::GetSelectedElement() is ugly. Probably, it's checked only with expected simple cases since the result does not make sense in some cases. For example, when Selection is collapsed, it returns an element only when "href" is specified with the argument. When Selection selects only one element node (including its children), it quickly returns the node, however, in the slow path, it returns second element node if first element node matches with the argument. Or returns first element ndoe if it does not match with the argument. For preventing regressions, new test is designed to keep current odd behavior. The new test is disabled only debug build on Android because adding this test causes permanent orange of non-related test, dom/tests/mochitest/fetch/test_request.html, see bug 1480702. --- editor/libeditor/tests/mochitest.ini | 2 + ...test_nsIHTMLEditor_getSelectedElement.html | 507 ++++++++++++++++++ 2 files changed, 509 insertions(+) create mode 100644 editor/libeditor/tests/test_nsIHTMLEditor_getSelectedElement.html diff --git a/editor/libeditor/tests/mochitest.ini b/editor/libeditor/tests/mochitest.ini index 53034cb69630..3e1733006b13 100644 --- a/editor/libeditor/tests/mochitest.ini +++ b/editor/libeditor/tests/mochitest.ini @@ -281,6 +281,8 @@ skip-if = android_version == '24' [test_middle_click_paste.html] subsuite = clipboard skip-if = android_version == '24' +[test_nsIHTMLEditor_getSelectedElement.html] +skip-if = toolkit == 'android' && debug # bug 1480702, causes permanent failure of non-related test [test_nsIHTMLEditor_selectElement.html] skip-if = toolkit == 'android' && debug # bug 1480702, causes permanent failure of non-related test [test_nsIHTMLEditor_setCaretAfterElement.html] diff --git a/editor/libeditor/tests/test_nsIHTMLEditor_getSelectedElement.html b/editor/libeditor/tests/test_nsIHTMLEditor_getSelectedElement.html new file mode 100644 index 000000000000..ecdaaee36244 --- /dev/null +++ b/editor/libeditor/tests/test_nsIHTMLEditor_getSelectedElement.html @@ -0,0 +1,507 @@ + + + + Test for nsIHTMLEditor.getSelectedElement() + + + + +
+
+
+
+
+ + + + +