From: <rb...@us...> - 2013-10-28 17:13:23
|
Revision: 8711 http://sourceforge.net/p/htmlunit/code/8711 Author: rbri Date: 2013-10-28 17:13:18 +0000 (Mon, 28 Oct 2013) Log Message: ----------- improved embed Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLEmbedElementTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-10-28 12:21:42 UTC (rev 8710) +++ trunk/htmlunit/src/changes/changes.xml 2013-10-28 17:13:18 UTC (rev 8711) @@ -8,6 +8,9 @@ <body> <release version="2.14" date="???" description="Bugfixes"> + <action type="add" dev="rbri"> + JavaScript: Embed now supports the width and hight property. + </action> <action type="fix" dev="rbri" issue="1551"> JavaScript: send the correct Referer header when changing the location property. </action> Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLEmbedElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLEmbedElementTest.java 2013-10-28 12:21:42 UTC (rev 8710) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLEmbedElementTest.java 2013-10-28 17:13:18 UTC (rev 8711) @@ -15,6 +15,7 @@ package com.gargoylesoftware.htmlunit.javascript.host.html; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.FF17; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE8; import org.junit.Test; @@ -110,4 +111,118 @@ + "</body></html>"; loadPageWithAlerts2(html); } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = { "10px", "20em", "80%", "40", "wrong", "" }, + IE = { "10", "20", "80%", "40", "1", "" }) + @NotYetImplemented(IE) + public void getHeight() throws Exception { + final String html + = "<html><body>\n" + + " <embed id='e1' height='10px' ></embed>\n" + + " <embed id='e2' height='20em' ></embed>\n" + + " <embed id='e3' height='80%' ></embed>\n" + + " <embed id='e4' height='40' ></embed>\n" + + " <embed id='e5' height='wrong' ></embed>\n" + + " <embed id='e6' ></embed>\n" + + + "<script>\n" + + " for (i=1; i<=6; i++) {\n" + + " alert(document.getElementById('e'+i).height);\n" + + " };\n" + + "</script>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = { "20px", "8", "foo" }, + IE = { "20", "8", "error", "8" }) + @NotYetImplemented(IE) + public void setHeight() throws Exception { + final String html + = "<html><body>\n" + + " <embed id='e1' height='10px' ></embed>\n" + + + "<script>\n" + + " function setHeight(elem, value) {\n" + + " try {\n" + + " elem.height = value;\n" + + " } catch (e) { alert('error'); }\n" + + " alert(elem.height);\n" + + " }\n" + + + " var elem = document.getElementById('e1');\n" + + " setHeight(elem, '20px');\n" + + + " setHeight(elem, '8');\n" + + " setHeight(elem, 'foo');\n" + + + "</script>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = { "10px", "20em", "80%", "40", "wrong", "" }, + IE = { "10", "20", "80%", "40", "1", "" }) + @NotYetImplemented(IE) + public void getWidth() throws Exception { + final String html + = "<html><body>\n" + + " <embed id='e1' width='10px' ></embed>\n" + + " <embed id='e2' width='20em' ></embed>\n" + + " <embed id='e3' width='80%' ></embed>\n" + + " <embed id='e4' width='40' ></embed>\n" + + " <embed id='e5' width='wrong' ></embed>\n" + + " <embed id='e6' ></embed>\n" + + + "<script>\n" + + " for (i=1; i<=6; i++) {\n" + + " alert(document.getElementById('e'+i).width);\n" + + " };\n" + + "</script>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = { "20px", "8", "foo" }, + IE = { "20", "8", "error", "8" }) + @NotYetImplemented(IE) + public void setWidth() throws Exception { + final String html + = "<html><body>\n" + + " <embed id='e1' width='10px' ></embed>\n" + + + "<script>\n" + + " function setWidth(elem, value) {\n" + + " try {\n" + + " elem.width = value;\n" + + " } catch (e) { alert('error'); }\n" + + " alert(elem.width);\n" + + " }\n" + + + " var elem = document.getElementById('e1');\n" + + " setWidth(elem, '20px');\n" + + + " setWidth(elem, '8');\n" + + " setWidth(elem, 'foo');\n" + + + "</script>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } } |