Skip to content

Lightpanda: the headless browser designed for AI and automation

update tests

Halil Durak4d8c0f6d928f
diff --git a/src/browser/tests/element/matches.html b/src/browser/tests/element/matches.html
index f28d7a716..a1a3743e5 100644
--- a/src/browser/tests/element/matches.html
+++ b/src/browser/tests/element/matches.html
@@ -62,6 +62,26 @@
}
</script>
+<script id=webkitMatchesSelector>
+{
+ // Legacy alias of matches(): same behaviour, including error handling.
+ const container = $('#test-container');
+ const span = $('#special');
+
+ testing.expectEqual(true, container.webkitMatchesSelector('#test-container'));
+ testing.expectEqual(true, container.webkitMatchesSelector('.container.main'));
+ testing.expectEqual(true, container.webkitMatchesSelector('*'));
+ testing.expectEqual(false, container.webkitMatchesSelector('p'));
+
+ testing.expectEqual(true, span.webkitMatchesSelector('span#special.wrapper'));
+ testing.expectEqual(false, span.webkitMatchesSelector('div'));
+
+ testing.expectError("SyntaxError", () => container.webkitMatchesSelector(''));
+
+ testing.expectEqual(1, Element.prototype.webkitMatchesSelector.length);
+}
+</script>
+
<script id=errorHandling>
{
const container = $('#test-container');