MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / onLoad

Method onLoad

src/test/java/org/htmlunit/html/HtmlLinkTest.java:35–53  ·  view source on GitHub ↗

@throws Exception if an error occurs

()

Source from the content-addressed store, hash-verified

33 * @throws Exception if an error occurs
34 */
35 @Test
36 @Alerts("body onLoad")
37 public void onLoad() throws Exception {
38 getWebClientWithMockWebConnection().getOptions().setCssEnabled(false);
39 getMockWebConnection().setResponse(new URL(URL_FIRST, "simple.css"), "");
40
41 final String html = DOCTYPE_HTML
42 + "<html>\n"
43 + "<head>\n"
44 + " <link rel='stylesheet' href='simple.css' "
45 + "onload='alert(\"onLoad\")' onerror='alert(\"onError\")'>\n"
46 + "</head>\n"
47 + "<body onload='alert(\"body onLoad\")'>\n"
48 + "</body>\n"
49 + "</html>";
50
51 loadPageWithAlerts(html);
52 assertEquals(1, getMockWebConnection().getRequestCount());
53 }
54
55 /**
56 * @throws Exception if an error occurs

Callers 15

api.jsFile · 0.45
htmx.test.tsFile · 0.45
api.jsFile · 0.45
htmx.test.tsFile · 0.45
api.jsFile · 0.45
htmx.test.tsFile · 0.45
api.jsFile · 0.45
htmx.test.tsFile · 0.45
api.jsFile · 0.45
htmx.test.tsFile · 0.45
api.jsFile · 0.45
htmx.test.tsFile · 0.45

Calls 8

setCssEnabledMethod · 0.80
setResponseMethod · 0.80
getMockWebConnectionMethod · 0.80
getRequestCountMethod · 0.80
getOptionsMethod · 0.45
loadPageWithAlertsMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected