Jacek Caban : mshtml/tests: Added IHTMLInputTextElement2 tests.

Alexandre Julliard julliard at winehq.org
Thu Jun 15 15:34:20 CDT 2017


Module: wine
Branch: master
Commit: 0286b11cdaef9a1f7b2efa7017dccb9253326ced
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0286b11cdaef9a1f7b2efa7017dccb9253326ced

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Jun 15 13:48:17 2017 +0200

mshtml/tests: Added IHTMLInputTextElement2 tests.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/tests/elements.js | 64 +++++++++++++++++++++++++++++++++++++++++++
 dlls/mshtml/tests/rsrc.rc     |  3 ++
 dlls/mshtml/tests/script.c    |  1 +
 3 files changed, 68 insertions(+)

diff --git a/dlls/mshtml/tests/elements.js b/dlls/mshtml/tests/elements.js
new file mode 100644
index 0000000..c307e50
--- /dev/null
+++ b/dlls/mshtml/tests/elements.js
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+function test_input_selection() {
+    var input = document.createElement("input");
+    input.type = "text";
+    input.value = "test";
+    document.body.appendChild(input);
+
+    function test_range(start, end) {
+        ok(input.selectionStart === start, "input.selectionStart = " + input.selectionStart + " expected " + start);
+        ok(input.selectionEnd === end, "input.selectionEnd = " + input.selectionEnd + " expected " + end);
+    }
+
+    test_range(0, 0);
+
+    input.selectionStart = 2;
+    test_range(2, 2);
+
+    input.selectionStart = -1;
+    test_range(0, 2);
+
+    input.selectionStart = 10;
+    test_range(4, 4);
+
+    input.selectionEnd = 2;
+    test_range(2, 2);
+
+    input.selectionEnd = -1;
+    test_range(0, 0);
+
+    input.selectionEnd = 10;
+    test_range(0, 4);
+
+    input.setSelectionRange(2, 3);
+    test_range(2, 3);
+
+    input.setSelectionRange(-1, 10);
+    test_range(0, 4);
+
+    input.setSelectionRange(3, 3);
+    test_range(3, 3);
+
+    next_test();
+}
+
+var tests = [
+    test_input_selection
+];
diff --git a/dlls/mshtml/tests/rsrc.rc b/dlls/mshtml/tests/rsrc.rc
index 1e2bdd0..2f90c00 100644
--- a/dlls/mshtml/tests/rsrc.rc
+++ b/dlls/mshtml/tests/rsrc.rc
@@ -43,6 +43,9 @@ navigation.js HTML "navigation.js"
 /* @makedep: xhr.js */
 xhr.js HTML "xhr.js"
 
+/* @makedep: elements.js */
+elements.js HTML "elements.js"
+
 /* @makedep: documentmode.js */
 documentmode.js HTML "documentmode.js"
 
diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c
index 2753d7d..045835b 100644
--- a/dlls/mshtml/tests/script.c
+++ b/dlls/mshtml/tests/script.c
@@ -3459,6 +3459,7 @@ static void run_js_tests(void)
     init_protocol_handler();
 
     run_script_as_http_with_mode("xhr.js", NULL, "11");
+    run_script_as_http_with_mode("elements.js", NULL, "11");
     run_script_as_http_with_mode("navigation.js", NULL, NULL);
     run_script_as_http_with_mode("navigation.js", NULL, "11");
 




More information about the wine-cvs mailing list