[MSHTML_WINETEST]
[reactos.git] / rostests / winetests / mshtml / events.html
index 131ba19..d4e2644 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script>
-var testevent_divid2_called = false, cnt=0;
+var testevent_divid2_called = false, testevent_document_called = false, cnt=0;
 
 function ok(b,m) {
     return external.ok(b, m);
@@ -71,8 +71,11 @@ function test_scriptfor() {
     ok("onclick" in div, "testevent not in div");
     ok(typeof(div.onclick) === "function", "typeof(div.onclick) = " + typeof(div.onclick));
     ok(testevent_divid2_called === false, "testevent_divid2_called = " + testevent_divid2_called);
+    ok(typeof(document.onclick) === "function", "typeof(document.onclick) = " + typeof(document.onclick));
+    ok(testevent_document_called === false, "testevent_document_called = " + testevent_document_called);
     div.click();
     ok(testevent_divid2_called === true, "testevent_divid2_called = " + testevent_divid2_called);
+    ok(testevent_document_called === true, "testevent_document_called = " + testevent_document_called);
 
     ok(!("ontest" in div), "testevent in div");
     ok(typeof(div.ontest) === "undefined", "typeof(div.ontest) = " + typeof(div.ontest));
@@ -111,14 +114,16 @@ function test_handler_this() {
     ok(calls == "div2,div2*,div1,div1*,body,body*", "calls = " + calls);
 }
 
-function runTests(t) {
+window.onload = function() {
     try {
         ok(cnt == 1, "cnt=" + cnt + " exception during loading?");
-        ok(t === window, "t !== window");
+        ok(this === window, "this !== window");
 
         ok(typeof(window.onload) === "function", "typeof(window.onload) = " + typeof(window.onload));
         ok(document.body.onload === window.onload, "document.body.onload !== window.onload");
 
+        ok(img_onload_called, "img.onload not called before window.onload");
+
         test_scriptfor();
         ondataavailable_test();
         test_handler_this();
@@ -129,13 +134,26 @@ function runTests(t) {
     external.reportSuccess();
 }
 </script>
+<script>
+var img = document.createElement("img");
+img.src = "http://test.winehq.org/tests/winehq_snapshot/index_files/winehq_logo_glass.png";
+
+var img_onload_called = false;
+img.onload = function() {
+    external.trace("img.onload");
+    img_onload_called = true;
+}
+</script>
 </head>
-<body onload="runTests(this)">
+<body>
 <div id="divid"></div>
 <div id="divid2"></div>
 <script event="onclick" for="divid2">
     testevent_divid2_called = true;
 </script>
+<script event="onclick" for="document">
+    testevent_document_called = true;
+</script>
 <script event="ontest" for="divid2">
     ok(false, "unexpected ontest");
 </script>
@@ -146,5 +164,8 @@ function runTests(t) {
     cnt++;
 })();
 </script>
+<script>
+document.body.appendChild(img);
+</script>
 </body>
 </html>