mshtml/tests: Use more winetest.js helpers in documentmode.js.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fb0fa9aacf
commit
44d58d35d1
|
@ -17,8 +17,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var compat_version;
|
var compat_version;
|
||||||
|
var tests = [];
|
||||||
|
|
||||||
function test_elem_props() {
|
sync_test("elem_props", function() {
|
||||||
var elem = document.documentElement;
|
var elem = document.documentElement;
|
||||||
|
|
||||||
function test_exposed(prop, expect) {
|
function test_exposed(prop, expect) {
|
||||||
|
@ -41,11 +42,9 @@ function test_elem_props() {
|
||||||
test_exposed("addEventListener", v >= 9);
|
test_exposed("addEventListener", v >= 9);
|
||||||
test_exposed("removeEventListener", v >= 9);
|
test_exposed("removeEventListener", v >= 9);
|
||||||
test_exposed("dispatchEvent", v >= 9);
|
test_exposed("dispatchEvent", v >= 9);
|
||||||
|
});
|
||||||
|
|
||||||
next_test();
|
sync_test("doc_props", function() {
|
||||||
}
|
|
||||||
|
|
||||||
function test_doc_props() {
|
|
||||||
function test_exposed(prop, expect) {
|
function test_exposed(prop, expect) {
|
||||||
if(expect)
|
if(expect)
|
||||||
ok(prop in document, prop + " not found in document.");
|
ok(prop in document, prop + " not found in document.");
|
||||||
|
@ -66,11 +65,9 @@ function test_doc_props() {
|
||||||
|
|
||||||
test_exposed("parentWindow", true);
|
test_exposed("parentWindow", true);
|
||||||
if(v >= 9) ok(document.defaultView === document.parentWindow, "defaultView != parentWindow");
|
if(v >= 9) ok(document.defaultView === document.parentWindow, "defaultView != parentWindow");
|
||||||
|
});
|
||||||
|
|
||||||
next_test();
|
sync_test("docfrag_props", function() {
|
||||||
}
|
|
||||||
|
|
||||||
function test_docfrag_props() {
|
|
||||||
var docfrag = document.createDocumentFragment();
|
var docfrag = document.createDocumentFragment();
|
||||||
|
|
||||||
function test_exposed(prop, expect) {
|
function test_exposed(prop, expect) {
|
||||||
|
@ -83,11 +80,9 @@ function test_docfrag_props() {
|
||||||
var v = document.documentMode;
|
var v = document.documentMode;
|
||||||
|
|
||||||
test_exposed("compareDocumentPosition", v >= 9);
|
test_exposed("compareDocumentPosition", v >= 9);
|
||||||
|
});
|
||||||
|
|
||||||
next_test();
|
sync_test("window_props", function() {
|
||||||
}
|
|
||||||
|
|
||||||
function test_window_props() {
|
|
||||||
function test_exposed(prop, expect) {
|
function test_exposed(prop, expect) {
|
||||||
if(expect)
|
if(expect)
|
||||||
ok(prop in window, prop + " not found in window.");
|
ok(prop in window, prop + " not found in window.");
|
||||||
|
@ -108,11 +103,9 @@ function test_window_props() {
|
||||||
test_exposed("getComputedStyle", v >= 9);
|
test_exposed("getComputedStyle", v >= 9);
|
||||||
if(v >= 9) /* FIXME: native exposes it in all compat modes */
|
if(v >= 9) /* FIXME: native exposes it in all compat modes */
|
||||||
test_exposed("performance", true);
|
test_exposed("performance", true);
|
||||||
|
});
|
||||||
|
|
||||||
next_test();
|
sync_test("xhr_props", function() {
|
||||||
}
|
|
||||||
|
|
||||||
function test_xhr_props() {
|
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
function test_exposed(prop, expect) {
|
function test_exposed(prop, expect) {
|
||||||
|
@ -127,11 +120,9 @@ function test_xhr_props() {
|
||||||
test_exposed("addEventListener", v >= 9);
|
test_exposed("addEventListener", v >= 9);
|
||||||
test_exposed("removeEventListener", v >= 9);
|
test_exposed("removeEventListener", v >= 9);
|
||||||
test_exposed("dispatchEvent", v >= 9);
|
test_exposed("dispatchEvent", v >= 9);
|
||||||
|
});
|
||||||
|
|
||||||
next_test();
|
sync_test("style_props", function() {
|
||||||
}
|
|
||||||
|
|
||||||
function test_style_props() {
|
|
||||||
var style = document.body.style;
|
var style = document.body.style;
|
||||||
|
|
||||||
function test_exposed(prop, expect) {
|
function test_exposed(prop, expect) {
|
||||||
|
@ -186,11 +177,9 @@ function test_style_props() {
|
||||||
test_exposed("background-clip", v >= 9);
|
test_exposed("background-clip", v >= 9);
|
||||||
test_exposed("transform", v >= 10);
|
test_exposed("transform", v >= 10);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
next_test();
|
sync_test("JS objs", function() {
|
||||||
}
|
|
||||||
|
|
||||||
function test_javascript() {
|
|
||||||
var g = window;
|
var g = window;
|
||||||
|
|
||||||
function test_exposed(func, obj, expect) {
|
function test_exposed(func, obj, expect) {
|
||||||
|
@ -239,11 +228,9 @@ function test_javascript() {
|
||||||
test_parses("if(false) { o.default; }", v >= 9);
|
test_parses("if(false) { o.default; }", v >= 9);
|
||||||
test_parses("if(false) { o.with; }", v >= 9);
|
test_parses("if(false) { o.with; }", v >= 9);
|
||||||
test_parses("if(false) { o.if; }", v >= 9);
|
test_parses("if(false) { o.if; }", v >= 9);
|
||||||
|
});
|
||||||
|
|
||||||
next_test();
|
sync_test("elem_by_id", function() {
|
||||||
}
|
|
||||||
|
|
||||||
function test_elem_by_id() {
|
|
||||||
document.body.innerHTML = '<form id="testid" name="testname"></form>';
|
document.body.innerHTML = '<form id="testid" name="testname"></form>';
|
||||||
|
|
||||||
var id_elem = document.getElementById("testid");
|
var id_elem = document.getElementById("testid");
|
||||||
|
@ -254,11 +241,9 @@ function test_elem_by_id() {
|
||||||
ok(id_elem === name_elem, "id_elem != id_elem");
|
ok(id_elem === name_elem, "id_elem != id_elem");
|
||||||
else
|
else
|
||||||
ok(name_elem === null, "name_elem != null");
|
ok(name_elem === null, "name_elem != null");
|
||||||
|
});
|
||||||
|
|
||||||
next_test();
|
sync_test("doc_mode", function() {
|
||||||
}
|
|
||||||
|
|
||||||
function test_doc_mode() {
|
|
||||||
compat_version = parseInt(document.location.search.substring(1));
|
compat_version = parseInt(document.location.search.substring(1));
|
||||||
|
|
||||||
trace("Testing compatibility mode " + compat_version);
|
trace("Testing compatibility mode " + compat_version);
|
||||||
|
@ -275,11 +260,9 @@ function test_doc_mode() {
|
||||||
ok(document.compatMode === "CSS1Compat", "document.compatMode = " + document.compatMode);
|
ok(document.compatMode === "CSS1Compat", "document.compatMode = " + document.compatMode);
|
||||||
else
|
else
|
||||||
ok(document.compatMode === "BackCompat", "document.compatMode = " + document.compatMode);
|
ok(document.compatMode === "BackCompat", "document.compatMode = " + document.compatMode);
|
||||||
|
});
|
||||||
|
|
||||||
next_test();
|
async_test("iframe_doc_mode", function() {
|
||||||
}
|
|
||||||
|
|
||||||
function test_iframe_doc_mode() {
|
|
||||||
var iframe = document.createElement("iframe");
|
var iframe = document.createElement("iframe");
|
||||||
|
|
||||||
iframe.onload = function() {
|
iframe.onload = function() {
|
||||||
|
@ -293,9 +276,9 @@ function test_iframe_doc_mode() {
|
||||||
|
|
||||||
iframe.src = "about:blank";
|
iframe.src = "about:blank";
|
||||||
document.body.appendChild(iframe);
|
document.body.appendChild(iframe);
|
||||||
}
|
});
|
||||||
|
|
||||||
function test_conditional_comments() {
|
sync_test("conditional_comments", function() {
|
||||||
var div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
|
|
||||||
|
@ -323,20 +306,4 @@ function test_conditional_comments() {
|
||||||
test_version(6);
|
test_version(6);
|
||||||
test_version(7);
|
test_version(7);
|
||||||
test_version(8);
|
test_version(8);
|
||||||
|
});
|
||||||
next_test();
|
|
||||||
}
|
|
||||||
|
|
||||||
var tests = [
|
|
||||||
test_doc_mode,
|
|
||||||
test_iframe_doc_mode,
|
|
||||||
test_elem_props,
|
|
||||||
test_doc_props,
|
|
||||||
test_docfrag_props,
|
|
||||||
test_window_props,
|
|
||||||
test_javascript,
|
|
||||||
test_xhr_props,
|
|
||||||
test_style_props,
|
|
||||||
test_elem_by_id,
|
|
||||||
test_conditional_comments
|
|
||||||
];
|
|
||||||
|
|
|
@ -90,3 +90,11 @@ function sync_test(name, f)
|
||||||
next_test();
|
next_test();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function async_test(name, f)
|
||||||
|
{
|
||||||
|
tests.push(function() {
|
||||||
|
test_name = name;
|
||||||
|
f();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue