Tests: Resync imported WPT tests

This commit is contained in:
Tim Ledbetter
2026-04-04 17:18:58 +01:00
committed by Shannon Booth
parent dda3cb99b7
commit 504a8e6d1d
Notes: github-actions[bot] 2026-04-04 21:38:15 +00:00
306 changed files with 6274 additions and 2460 deletions

View File

@@ -47,6 +47,16 @@ test(() => {
assert_equals(clone.elementInternals.shadowRoot.querySelector('a-b').__proto__.constructor.name, 'HTMLElement');
}, 'upgrade is a no-op when called on a shadow root with no association');
test(() => {
const registry1 = new CustomElementRegistry;
const registry2 = new CustomElementRegistry;
const element = document.createElement('a-b', {customElementRegistry: registry1});
registry1.define('a-b', class ABElement1 extends HTMLElement { });
assert_false(element.matches(':defined'));
registry2.upgrade(element);
assert_false(element.matches(':defined'));
}, 'upgrade is a no-op when called on an element associated with a different registry');
test(() => {
const registry = new CustomElementRegistry;
registry.define('a-b', class ABElement extends HTMLElement {

View File

@@ -85,6 +85,20 @@ test(() => {
assert_equals(element.customElementRegistry, registry);
}, 'customElementRegistry on a defined custom element created by calling createElement on CustomElementRegistry should return the registry');
test(() => {
const registry = new CustomElementRegistry;
let registryInConstructor = null;
registry.define('check-registry-in-constructor', class extends HTMLElement {
constructor() {
super();
registryInConstructor = this.customElementRegistry;
}
});
const element = document.createElement('check-registry-in-constructor', {customElementRegistry: registry});
assert_equals(registryInConstructor, registry);
assert_equals(element.customElementRegistry, registry);
}, 'customElementRegistry inside a custom element constructor should return the correct registry');
</script>
</body>
</html>