From: <rb...@us...> - 2017-05-29 17:22:41
|
Revision: 14487 http://sourceforge.net/p/htmlunit/code/14487 Author: rbri Date: 2017-05-29 17:22:37 +0000 (Mon, 29 May 2017) Log Message: ----------- missing tests for the new svg element Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementOuterHtmlTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/property/ElementClientWidthTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/property/ElementOffsetWidthTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java 2017-05-29 17:12:30 UTC (rev 14486) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java 2017-05-29 17:22:37 UTC (rev 14487) @@ -93,6 +93,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlScript; import com.gargoylesoftware.htmlunit.html.HtmlSvg; import com.gargoylesoftware.htmlunit.html.HtmlUnknownElement; +import com.gargoylesoftware.htmlunit.html.UnknownElementFactory; import com.gargoylesoftware.htmlunit.html.impl.SimpleRange; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; import com.gargoylesoftware.htmlunit.javascript.configuration.CanSetReadOnly; @@ -689,7 +690,8 @@ ((HtmlUnknownElement) element).markAsCreatedByJavascript(); } else if (element instanceof HtmlSvg) { - element = page.createElement("unknown"); + element = UnknownElementFactory.instance.createElementNS(page, "", "svg", null); + ((HtmlUnknownElement) element).markAsCreatedByJavascript(); } final Object jsElement = getScriptableFor(element); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementOuterHtmlTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementOuterHtmlTest.java 2017-05-29 17:12:30 UTC (rev 14486) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementOuterHtmlTest.java 2017-05-29 17:22:37 UTC (rev 14487) @@ -1117,6 +1117,15 @@ * @throws Exception if the test fails */ @Test + @Alerts("<svg></svg>") + public void svg() throws Exception { + loadPageWithAlerts2(test("svg")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts("<table></table>") public void table() throws Exception { loadPageWithAlerts2(test("table")); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java 2017-05-29 17:12:30 UTC (rev 14486) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java 2017-05-29 17:22:37 UTC (rev 14487) @@ -2395,6 +2395,17 @@ } /** + * Test {@link com.gargoylesoftware.htmlunit.html.HtmlSvg}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts("-") + public void svg() throws Exception { + test("svg"); + } + + /** * Test {@link com.gargoylesoftware.htmlunit.html.HtmlTable}. * * @throws Exception if the test fails Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/property/ElementClientWidthTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/property/ElementClientWidthTest.java 2017-05-29 17:12:30 UTC (rev 14486) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/property/ElementClientWidthTest.java 2017-05-29 17:22:37 UTC (rev 14487) @@ -1460,6 +1460,19 @@ } /** + * Test {@link com.gargoylesoftware.htmlunit.html.HtmlSvg}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = "300", + FF = "0") + @NotYetImplemented + public void svg() throws Exception { + loadPageWithAlerts2(test("svg")); + } + + /** * Test {@link com.gargoylesoftware.htmlunit.html.HtmlTable}. * * @throws Exception if the test fails Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/property/ElementOffsetWidthTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/property/ElementOffsetWidthTest.java 2017-05-29 17:12:30 UTC (rev 14486) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/property/ElementOffsetWidthTest.java 2017-05-29 17:22:37 UTC (rev 14487) @@ -1461,6 +1461,17 @@ } /** + * Test {@link com.gargoylesoftware.htmlunit.html.HtmlSvg}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts("NaN") + public void svg() throws Exception { + loadPageWithAlerts2(test("svg")); + } + + /** * Test {@link com.gargoylesoftware.htmlunit.html.HtmlTable}. * * @throws Exception if the test fails |