mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
Tests: Resync imported WPT tests
This commit is contained in:
committed by
Shannon Booth
parent
dda3cb99b7
commit
504a8e6d1d
Notes:
github-actions[bot]
2026-04-04 21:38:15 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/504a8e6d1d3 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8776 Reviewed-by: https://github.com/shannonbooth ✅
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user