Skip to content

Commit 18be75e

Browse files
committed
more detailed test
1 parent 092c7a2 commit 18be75e

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/test/java/org/htmlunit/javascript/host/html/HTMLDocumentWrite2Test.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -886,24 +886,36 @@ public void writeWithSpace() throws Exception {
886886
* @throws Exception if the test fails
887887
*/
888888
@Test
889-
@Alerts({"foo", "foo2"})
889+
@Alerts({"0", "foo1", "1", "2", "3", "4", "5", "A", "B", "foo3"})
890890
public void writeScriptInManyTimes() throws Exception {
891891
final String html = "<html>\n"
892892
+ "<head>\n"
893893
+ "<script>\n"
894894
+ LOG_TITLE_FUNCTION
895-
+ "document.write('<script src=\"script.js\">');\n"
896-
+ "document.write('<' + '/script>');\n"
897-
+ "document.write('<script>log(\"foo2\");</' + 'script>');\n"
895+
+ " log('0');\n"
896+
+ " document.write('<script>log(\"foo1\");</' + 'script>');\n"
897+
898+
+ " log('1');\n"
899+
+ " document.write('<script src=\"scriptA.js\">;</' + 'script>');\n"
900+
+ " log('2');\n"
901+
902+
+ " document.write('<script src=\"scriptB.js\">');\n"
903+
+ " log('3');\n"
904+
+ " document.write('<' + '/script>');\n"
905+
+ " log('4');\n"
906+
+ " document.write('<script>log(\"foo3\");</' + 'script>');\n"
907+
+ " log('5');\n"
898908
+ "</script>\n"
899909
+ "</head>\n"
900910
+ "<body>\n"
901911
+ "</body></html>";
902912

903-
final URL scriptUrl = new URL(URL_FIRST, "script.js");
913+
final URL scriptUrlA = new URL(URL_FIRST, "scriptA.js");
914+
final URL scriptUrlB = new URL(URL_FIRST, "scriptB.js");
904915

905916
getMockWebConnection().setDefaultResponse(html);
906-
getMockWebConnection().setResponse(scriptUrl, "log('foo');\n", MimeType.TEXT_JAVASCRIPT);
917+
getMockWebConnection().setResponse(scriptUrlA, "log('A');\n", MimeType.TEXT_JAVASCRIPT);
918+
getMockWebConnection().setResponse(scriptUrlB, "log('B');\n", MimeType.TEXT_JAVASCRIPT);
907919

908920
loadPageVerifyTitle2(html);
909921
}

0 commit comments

Comments
 (0)