Commit 4d469b55 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added function overriding tests.

parent 6d3bfe8e
...@@ -103,15 +103,34 @@ function test_getter_call() { ...@@ -103,15 +103,34 @@ function test_getter_call() {
var e = document.getElementById("divid"); var e = document.getElementById("divid");
e.myfunc = function(x) { this.myfinc_called = x; }; e.myfunc = function(x) { this.myfunc_called = x; };
e.myfunc("test"); e.myfunc("test");
ok(e.myfinc_called === "test", "e.myfinc_called = " + e.myfinc_called); ok(e.myfunc_called === "test", "e.myfunc_called = " + e.myfunc_called);
e.onmousedown = function(x) { this.onmousedown_called = x; }; e.onmousedown = function(x) { this.onmousedown_called = x; };
e.onmousedown("test"); e.onmousedown("test");
ok(e.onmousedown_called === "test", "e.onmousedown_called = " + e.onmousedown_called); ok(e.onmousedown_called === "test", "e.onmousedown_called = " + e.onmousedown_called);
} }
function test_override_functions() {
function override_func() { return "test"; }
ok(typeof(window.showModalDialog) === "object", "typeof(window.showModalDialog) = " + typeof(window.showModalDialog));
window.showModalDialog = override_func;
ok(window.showModalDialog === override_func, "window.showModalDialog != override_func");
ok(typeof(window.showModalDialog) === "function", "typeof(window.showModalDialog) = " + typeof(window.showModalDialog));
document.body.innerHTML = '<div id="divid"></div>';
var div = document.getElementById("divid");
ok(typeof(div.addBehavior) === "object", "typeof(div.addBehavior) = " + typeof(div.addBehavior));
div.addBehavior = override_func;
ok(div.addBehavior === override_func, "div.addBehavior != override_func");
ok(typeof(div.addBehavior) === "function", "typeof(div.addBehavior) = " + typeof(div.addBehavior));
var tmp = div.addBehavior();
ok(tmp === "test", "div.addBehavior() = " + tmp);
}
var globalVar = false; var globalVar = false;
function runTest() { function runTest() {
...@@ -128,6 +147,7 @@ function runTest() { ...@@ -128,6 +147,7 @@ function runTest() {
test_document_name_as_index(); test_document_name_as_index();
test_remove_style_attribute(); test_remove_style_attribute();
test_getter_call(); test_getter_call();
test_override_functions();
var r = window.execScript("globalVar = true;"); var r = window.execScript("globalVar = true;");
ok(r === undefined, "execScript returned " + r); ok(r === undefined, "execScript returned " + r);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment