diff --git a/src/test/java/org/htmlunit/javascript/host/html/HTMLElementTest.java b/src/test/java/org/htmlunit/javascript/host/html/HTMLElementTest.java index 82cc197125..20cf3a36f5 100644 --- a/src/test/java/org/htmlunit/javascript/host/html/HTMLElementTest.java +++ b/src/test/java/org/htmlunit/javascript/host/html/HTMLElementTest.java @@ -3941,6 +3941,7 @@ public void appendChildExecuteJavaScript() throws Exception { + "\n" + "
\n" + ""; + loadPageVerifyTitle2(html); } @@ -3971,6 +3972,7 @@ public void appendChildExecuteNestedJavaScript() throws Exception { + "\n" + "
\n" + ""; + loadPageVerifyTitle2(html); } @@ -4004,7 +4006,8 @@ public void appendChildExecuteNestedExternalJavaScript() throws Exception { + "
\n" + ""; - loadPageVerifyTitle2(html); + loadPage2(html); + verifyTitle2(DEFAULT_WAIT_TIME, getWebDriver(), getExpectedAlerts()); } /** @@ -4615,7 +4618,7 @@ public void insertBeforeDeclareJavaScript() throws Exception { * @throws Exception if the test fails */ @Test - @Alerts("executed") + @Alerts({"replaceChild start", "executed", "replaceChild done"}) public void replaceChildExecuteJavaScript() throws Exception { final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "\n" + "
\n" + ""; + loadPageVerifyTitle2(html); } @@ -4641,7 +4647,39 @@ public void replaceChildExecuteJavaScript() throws Exception { * @throws Exception if the test fails */ @Test - @Alerts("executed") + @Alerts({"replaceChild start", "replaceChild done", "executed"}) + public void replaceChildExecuteExternalJavaScript() throws Exception { + getMockWebConnection().setDefaultResponse("alerter();", MimeType.TEXT_JAVASCRIPT); + + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "\n" + + "
\n" + + ""; + + loadPage2(html); + verifyTitle2(DEFAULT_WAIT_TIME, getWebDriver(), getExpectedAlerts()); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({"replaceChild start", "executed", "replaceChild done"}) public void replaceChildExecuteNestedJavaScript() throws Exception { final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "\n" + "
\n" + ""; + loadPageVerifyTitle2(html); } @@ -4669,9 +4710,43 @@ public void replaceChildExecuteNestedJavaScript() throws Exception { * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = {"executed", "replaceChild done"}, - FF = "replaceChild done", - FF_ESR = "replaceChild done") + @Alerts({"replaceChild start", "replaceChild done", "executed"}) + public void replaceChildExecuteNestedExternalJavaScript() throws Exception { + getMockWebConnection().setDefaultResponse("alerter();", MimeType.TEXT_JAVASCRIPT); + + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "\n" + + "
\n" + + ""; + + loadPage2(html); + verifyTitle2(DEFAULT_WAIT_TIME, getWebDriver(), getExpectedAlerts()); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = {"replaceChild start", "executed", "replaceChild done"}, + FF = {"replaceChild start", "replaceChild done"}, + FF_ESR = {"replaceChild start", "replaceChild done"}) public void replaceChildExecuteTemplateChildJavaScript() throws Exception { final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "\n" + + "\n" + + "
\n" + + ""; + + loadPage2(html); + verifyTitle2(DEFAULT_WAIT_TIME, getWebDriver(), getExpectedAlerts()); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = {"replaceChild start1", "executed", "replaceChild done1", + "replaceChild start2", "replaceChild done2"}, + FF = {"replaceChild start1", "replaceChild done1", "replaceChild start2", "replaceChild done2"}, + FF_ESR = {"replaceChild start1", "replaceChild done1", "replaceChild start2", "replaceChild done2"}) public void replaceChildExecuteTemplateFragmentJavaScript() throws Exception { final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "\n" + + "\n" + + "
\n" + + "
\n" + + ""; + + loadPage2(html); + verifyTitle2(DEFAULT_WAIT_TIME, getWebDriver(), getExpectedAlerts()); + } + /** * @throws Exception if the test fails */