Jacek Caban : mshtml: Added more events tests.
Alexandre Julliard
julliard at winehq.org
Mon Oct 22 13:42:45 CDT 2012
Module: wine
Branch: master
Commit: 516731c8618d0b30e4fb0298bd6b3b89fc7c2051
URL: http://source.winehq.org/git/wine.git/?a=commit;h=516731c8618d0b30e4fb0298bd6b3b89fc7c2051
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Oct 22 12:00:06 2012 +0200
mshtml: Added more events tests.
---
dlls/mshtml/tests/events.html | 42 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/tests/events.html b/dlls/mshtml/tests/events.html
index b3b6958..131ba19 100644
--- a/dlls/mshtml/tests/events.html
+++ b/dlls/mshtml/tests/events.html
@@ -78,12 +78,50 @@ function test_scriptfor() {
ok(typeof(div.ontest) === "undefined", "typeof(div.ontest) = " + typeof(div.ontest));
}
-function runTests() {
+function test_handler_this() {
+ document.body.innerHTML = '<div id="d1"><div id="d2"></div></div>';
+
+ var div1 = document.getElementById("d1");
+ var div2 = document.getElementById("d2");
+ var calls = new Array();
+
+ function createHandler(name, node) {
+ return function() {
+ ok(this === node, "this !== node");
+ calls.push(name);
+ }
+ }
+
+ function registerHandler(name, target) {
+ var b = target.attachEvent("onclick", function() {
+ ok(this === window, "this !== window");
+ calls.push(name+"*");
+ });
+ ok(b, "attachEvent failed");
+ }
+
+ registerHandler("div1", div1);
+ registerHandler("div2", div2);
+ registerHandler("body", document.body);
+ div1.onclick = createHandler("div1", div1);
+ div2.onclick = createHandler("div2", div2);
+ document.body.onclick = createHandler("body", document.body);
+
+ div2.click();
+ ok(calls == "div2,div2*,div1,div1*,body,body*", "calls = " + calls);
+}
+
+function runTests(t) {
try {
ok(cnt == 1, "cnt=" + cnt + " exception during loading?");
+ ok(t === window, "t !== window");
+
+ ok(typeof(window.onload) === "function", "typeof(window.onload) = " + typeof(window.onload));
+ ok(document.body.onload === window.onload, "document.body.onload !== window.onload");
test_scriptfor();
ondataavailable_test();
+ test_handler_this();
}catch(e) {
ok(false, "Got an exception: " + e.message);
}
@@ -92,7 +130,7 @@ function runTests() {
}
</script>
</head>
-<body onload="runTests()">
+<body onload="runTests(this)">
<div id="divid"></div>
<div id="divid2"></div>
<script event="onclick" for="divid2">
More information about the wine-cvs
mailing list