Add tests for Event

Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
Francis Bouvier
2024-01-19 16:46:09 +01:00
parent da0a54a0df
commit de7fe8ba09
3 changed files with 87 additions and 3 deletions

View File

@@ -60,6 +60,8 @@ pub fn testExecFn(
var common = [_]Case{
.{ .src = "let content = document.getElementById('content')", .ex = "undefined" },
.{ .src = "let para = document.getElementById('para')", .ex = "undefined" },
// NOTE: as some event properties will change during the event dispatching phases
// we need to copy thoses values in order to check them afterwards
.{ .src =
\\var nb = 0; var evt; var phase; var cur;
\\function cbk(event) {
@@ -121,6 +123,7 @@ pub fn testExecFn(
.{ .src = "nb", .ex = "1" },
.{ .src = "evt instanceof Event", .ex = "true" },
.{ .src = "evt.type", .ex = "bubbles" },
.{ .src = "evt.bubbles", .ex = "true" },
.{ .src = "phase", .ex = "2" },
.{ .src = "cur.getAttribute('id')", .ex = "content" },
};