Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/test/java/org/htmlunit/general/ElementCreationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,17 @@ public void header() throws Exception {
test("header");
}

/**
* Test {@link org.htmlunit.html.HtmlUnknownElement}.
*
* @throws Exception if an error occurs
*/
@Test
@Alerts("[object HTMLUnknownElement]")
public void hgroup() throws Exception {
test("hgroup");
}

/**
* Test {@link org.htmlunit.html.HtmlHeading1}.
*
Expand Down
25 changes: 25 additions & 0 deletions src/test/java/org/htmlunit/html/HtmlUnknownElementTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,29 @@ public void asXml() throws Exception {
final String xml = driver.getPageSource();
assertTrue("Node not expanded in: " + xml, xml.contains("</foo>"));
}

/**
* @throws Exception if the test fails
*/
@Test
@Alerts("[object HTMLUnknownElement]")
public void hgroupScriptable() throws Exception {
final String html = DOCTYPE_HTML
+ "<html><head>\n"
+ "<script>\n"
+ LOG_TITLE_FUNCTION
+ " function test() {\n"
+ " log(document.getElementById('myId'));\n"
+ " }\n"
+ "</script>\n"
+ "</head><body onload='test()'>\n"
+ "<hgroup id='myId'></hgroup>\n"
+ "</body></html>";

final WebDriver driver = loadPageVerifyTitle2(html);
if (driver instanceof HtmlUnitDriver) {
final HtmlPage page = (HtmlPage) getEnclosedPage();
assertTrue(page.getHtmlElementById("myId") instanceof HtmlUnknownElement);
}
}
}