[HtmlUnit] SVN: [13765] trunk/htmlunit/src

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[HtmlUnit] SVN: [13765] trunk/htmlunit/src

rbri
Revision: 13765
          http://sourceforge.net/p/htmlunit/code/13765
Author:   rbri
Date:     2017-03-15 20:45:17 +0000 (Wed, 15 Mar 2017)
Log Message:
-----------
Fix detection of HtmlInput types (IE)

Modified Paths:
--------------
    trunk/htmlunit/src/changes/changes.xml
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/InputElementFactory.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlPasswordInputTest.java

Modified: trunk/htmlunit/src/changes/changes.xml
===================================================================
--- trunk/htmlunit/src/changes/changes.xml 2017-03-15 20:43:58 UTC (rev 13764)
+++ trunk/htmlunit/src/changes/changes.xml 2017-03-15 20:45:17 UTC (rev 13765)
@@ -8,10 +8,13 @@
 
     <body>
         <release version="2.26" date="???" description="Bugfixes">
-            <action type="fix" issue="#1858" due-to="Joerg Werner">
+            <action type="fix" dev="asashour">
+                Fix detection of HtmlInput types (IE).
+            </action>
+            <action type="fix" dev="rbri" issue="1858" due-to="Joerg Werner">
                 Correct file type detection for files with css suffix.
             </action>
-            <action type="add" dev="rbri">
+            <action type="add" >
                 JavaScript: simple impl for MediaSource.isTypeSupported added (returns always false).
             </action>
             <action type="add" dev="asashour">

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/InputElementFactory.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/InputElementFactory.java 2017-03-15 20:43:58 UTC (rev 13764)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/InputElementFactory.java 2017-03-15 20:45:17 UTC (rev 13765)
@@ -85,8 +85,10 @@
         }
 
         String type = null;
-        if (attributes != null) {
-            type = attributes.getValue("type");
+        for (final Map.Entry<String, DomAttr> entry : attributeMap.entrySet()) {
+            if ("type".equalsIgnoreCase(entry.getKey())) {
+                type = entry.getValue().getValue();
+            }
         }
         if (type == null) {
             type = "";

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlPasswordInputTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlPasswordInputTest.java 2017-03-15 20:43:58 UTC (rev 13764)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlPasswordInputTest.java 2017-03-15 20:45:17 UTC (rev 13765)
@@ -24,6 +24,7 @@
 import org.openqa.selenium.InvalidElementStateException;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
 
 import com.gargoylesoftware.htmlunit.BrowserRunner;
 import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts;
@@ -595,4 +596,27 @@
             + "</html>";
         loadPageWithAlerts2(html);
     }
+
+    /**
+     * @throws Exception if an error occurs
+     */
+    @Test
+    @Alerts("password")
+    public void upperCase() throws Exception {
+        final String html =
+              "<html><head><script>\n"
+            + "  function test() {\n"
+            + "    alert(document.getElementById('myId').type);\n"
+            + "  }\n"
+            + "</script></head>\n"
+            + "<body onload='test()'>\n"
+            + "  <input TYPE='password' id='myId'>\n"
+            + "</body></html>";
+        final WebDriver driver = loadPageWithAlerts2(html);
+        if (driver instanceof HtmlUnitDriver) {
+            final HtmlPage page = (HtmlPage) getWebWindowOf((HtmlUnitDriver) driver).getEnclosedPage();
+            assertTrue(HtmlPasswordInput.class.isInstance(page.getHtmlElementById("myId")));
+        }
+    }
+
 }


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
Loading...