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

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

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

asashour-2
Revision: 14118
          http://sourceforge.net/p/htmlunit/code/14118
Author:   asashour
Date:     2017-04-16 08:10:51 +0000 (Sun, 16 Apr 2017)
Log Message:
-----------
add test case

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeList.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeListTest.java

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeList.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeList.java 2017-04-15 20:03:57 UTC (rev 14117)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeList.java 2017-04-16 08:10:51 UTC (rev 14118)
@@ -100,7 +100,7 @@
     }
 
     /**
-     * Returns an {@link Iterator} allowing to go through all keys contained in this object.
+     * Returns an {@link Iterator} allowing to go through all keys contained in this object.
      * @return an {@link Iterator}
      */
     @JsxFunction({@WebBrowser(CHROME), @WebBrowser(value = FF, minVersion = 52)})
@@ -115,7 +115,7 @@
     }
 
     /**
-     * Returns an {@link Iterator} allowing to go through all keys contained in this object.
+     * Returns an {@link Iterator} allowing to go through all keys contained in this object.
      * @return an {@link Iterator}
      */
     @JsxFunction({@WebBrowser(CHROME), @WebBrowser(value = FF, minVersion = 52)})

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeListTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeListTest.java 2017-04-15 20:03:57 UTC (rev 14117)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeListTest.java 2017-04-16 08:10:51 UTC (rev 14118)
@@ -102,4 +102,39 @@
         loadPageWithAlerts2(html);
     }
 
+    /**
+     * @throws Exception if an error occurs
+     */
+    @Test
+    @Alerts(DEFAULT = {"[object HTMLHtmlElement] 0 [object NodeList] undefined",
+                "[object HTMLHeadElement] 1 [object NodeList] undefined",
+                "[object HTMLTitleElement] 2 [object NodeList] undefined",
+                "[object HTMLScriptElement] 3 [object NodeList] undefined",
+                "[object HTMLBodyElement] 4 [object NodeList] undefined",
+                "[object HTMLDivElement] 5 [object NodeList] undefined"},
+            FF45 = "no forEach",
+            IE = "no forEach",
+            EDGE = "no forEach")
+    @NotYetImplemented({CHROME, FF52})
+    public void forEach() throws Exception {
+        final String html = "<html><head><title>test</title>\n"
+            + "<script>\n"
+            + "  function test() {\n"
+            + "   var nodeList = document.querySelectorAll('*');\n"
+            + "   if (nodeList.forEach) {\n"
+            + "     nodeList.forEach(myFunction, 'something');\n"
+            + "   } else {\n"
+            + "     alert('no forEach');\n"
+            + "   }\n"
+            + "  }\n"
+            + "  function myFunction(value, index, list, arg) {\n"
+            + "    alert(value + ' ' + index + ' ' + list + ' ' + arg);\n"
+            + "  }\n"
+            + "</script>\n"
+            + "</head><body onload='test()'>\n"
+            + "  <div></div>\n"
+            + "</body></html>";
+
+        loadPageWithAlerts2(html);
+    }
 }


------------------------------------------------------------------------------
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