mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
document: re-dispatch tests between node document and html document
This commit is contained in:
@@ -48,7 +48,6 @@ pub fn testExecFn(
|
||||
.{ .src = "document.__proto__.__proto__.constructor.name", .ex = "Document" },
|
||||
.{ .src = "document.__proto__.__proto__.__proto__.constructor.name", .ex = "Node" },
|
||||
.{ .src = "document.__proto__.__proto__.__proto__.__proto__.constructor.name", .ex = "EventTarget" },
|
||||
.{ .src = "document.body.localName == 'body'", .ex = "true" },
|
||||
};
|
||||
try checkCases(js_env, &constructor);
|
||||
|
||||
|
||||
@@ -34,39 +34,7 @@ pub fn testExecFn(
|
||||
var constructor = [_]Case{
|
||||
.{ .src = "document.__proto__.constructor.name", .ex = "HTMLDocument" },
|
||||
.{ .src = "document.__proto__.__proto__.constructor.name", .ex = "Document" },
|
||||
.{ .src = "document.__proto__.__proto__.__proto__.constructor.name", .ex = "Node" },
|
||||
.{ .src = "document.__proto__.__proto__.__proto__.__proto__.constructor.name", .ex = "EventTarget" },
|
||||
.{ .src = "document.body.localName == 'body'", .ex = "true" },
|
||||
};
|
||||
try checkCases(js_env, &constructor);
|
||||
|
||||
var getElementById = [_]Case{
|
||||
.{ .src = "let getElementById = document.getElementById('content')", .ex = "undefined" },
|
||||
.{ .src = "getElementById.constructor.name", .ex = "HTMLDivElement" },
|
||||
.{ .src = "getElementById.localName", .ex = "div" },
|
||||
};
|
||||
try checkCases(js_env, &getElementById);
|
||||
|
||||
const tags = comptime parser.Tag.all();
|
||||
const elements = comptime parser.Tag.allElements();
|
||||
comptime var createElements: [(tags.len) * 3]Case = undefined;
|
||||
inline for (tags, elements, 0..) |tag, element_name, i| {
|
||||
// if (tag == .undef) {
|
||||
// continue;
|
||||
// }
|
||||
const tag_name = @tagName(tag);
|
||||
createElements[i * 3] = Case{
|
||||
.src = "var " ++ tag_name ++ "Elem = document.createElement('" ++ tag_name ++ "')",
|
||||
.ex = "undefined",
|
||||
};
|
||||
createElements[(i * 3) + 1] = Case{
|
||||
.src = tag_name ++ "Elem.constructor.name",
|
||||
.ex = "HTML" ++ element_name ++ "Element",
|
||||
};
|
||||
createElements[(i * 3) + 2] = Case{
|
||||
.src = tag_name ++ "Elem.localName",
|
||||
.ex = tag_name,
|
||||
};
|
||||
}
|
||||
try checkCases(js_env, &createElements);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user