Skip to content

Commit 3004d6a

Browse files
committed
one more test case
1 parent d598d73 commit 3004d6a

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

src/test/java/org/htmlunit/javascript/host/Window2Test.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3239,5 +3239,38 @@ public void performancePropertyEdit() throws Exception {
32393239

32403240
loadPageVerifyTitle2(html);
32413241
}
3242-
}
32433242

3243+
/**
3244+
* setInterval execution is not stopped if the callback throws an exception.
3245+
*
3246+
* @throws Exception if the test fails
3247+
*/
3248+
@Test
3249+
@Alerts({"c0", "c1", "c2", "c3", "c4", "cancelled"})
3250+
public void setIntervallProceeds() throws Exception {
3251+
final String content = DOCTYPE_HTML
3252+
+ "<html>\n"
3253+
+ "<head>\n"
3254+
+ "</head>\n"
3255+
+ "<body>\n"
3256+
+ "<script>\n"
3257+
+ LOG_TITLE_FUNCTION
3258+
+ "var intervalID = setInterval(myCallback, 50);\n"
3259+
+ "var count = 0;\n"
3260+
+ "function myCallback() {\n"
3261+
+ " log('c' + count);\n"
3262+
+ " if (count == 4) {\n"
3263+
+ " clearInterval(intervalID);\r\n"
3264+
+ " log('cancelled');\r\n"
3265+
+ " }\n"
3266+
+ " count++;\n"
3267+
+ " test.hide();\n"
3268+
+ "}\n"
3269+
+ "</script>\n"
3270+
+ "</body>\n"
3271+
+ "</html>";
3272+
3273+
loadPage2(content);
3274+
verifyTitle2(DEFAULT_WAIT_TIME, getWebDriver(), getExpectedAlerts());
3275+
}
3276+
}

0 commit comments

Comments
 (0)