Files
ladybird/Tests/LibWeb/Text/input/wpt-import/custom-elements/registries/pseudo-class-defined.window.js
Sam Atkins fe3c6a1f9f Tests: Import WPT custom-elements/registries tests
Includes reimporting the test we already had, which has changed
significantly.

Most of these fail, but importing them now to track progress.
2026-03-27 19:49:55 +00:00

28 lines
1.2 KiB
JavaScript

test(() => {
const otherDocument = new Document();
const element = otherDocument.createElement("blah");
assert_true(element.matches(":defined"));
const registry = new CustomElementRegistry();
registry.initialize(element);
assert_equals(element.customElementRegistry, registry);
assert_true(element.matches(":defined"));
}, `"uncustomized" :defined doesn't care about your registry'`);
test(() => {
const registry = new CustomElementRegistry();
registry.define("sw-r2d2", class extends HTMLElement {});
const element = document.createElement("sw-r2d2", { customElementRegistry: registry });
assert_equals(element.customElementRegistry, registry);
assert_true(element.matches(":defined"));
}, `"custom" :defined doesn't care about your registry`);
test(() => {
const otherDocument = new Document();
const element = otherDocument.createElementNS("http://www.w3.org/1999/xhtml", "sw-r2d2");
assert_false(element.matches(":defined"));
const registry = new CustomElementRegistry();
registry.define("sw-r2d2", class extends HTMLElement {});
registry.initialize(element);
assert_true(element.matches(":defined"));
}, `"custom" :defined should apply after initialize`);