mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Test steps 4 and 5 of the HTMLConstructor
This commit is contained in:
parent
1f3fd77d8f
commit
81e28a2b5f
2 changed files with 13 additions and 1 deletions
|
@ -554120,7 +554120,7 @@
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"custom-elements/HTMLElement-constructor.html": [
|
"custom-elements/HTMLElement-constructor.html": [
|
||||||
"7fefdaa4cbdf30c505858730a5a3858e9db5dbc2",
|
"64522527ef425b90c704b20b000c8feef0d1ca25",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"custom-elements/OWNERS": [
|
"custom-elements/OWNERS": [
|
||||||
|
|
|
@ -27,6 +27,18 @@ test(function () {
|
||||||
assert_throws({'name': 'TypeError'}, function () { new SomeCustomElement; });
|
assert_throws({'name': 'TypeError'}, function () { new SomeCustomElement; });
|
||||||
}, 'HTMLElement constructor must throw TypeError when it has not been defined by customElements.define');
|
}, 'HTMLElement constructor must throw TypeError when it has not been defined by customElements.define');
|
||||||
|
|
||||||
|
test(function () {
|
||||||
|
class SomeCustomElement extends HTMLParagraphElement {};
|
||||||
|
customElements.define('some-custom-element', SomeCustomElement);
|
||||||
|
assert_throws({'name': 'TypeError'}, function () { new SomeCustomElement(); });
|
||||||
|
}, 'Custom element constructor must throw TypeError when it does not extend HTMLElement');
|
||||||
|
|
||||||
|
test(function () {
|
||||||
|
class SomeCustomButtonElement extends HTMLButtonElement {};
|
||||||
|
customElements.define('some-custom-button-element', SomeCustomButtonElement, { extends: "p" });
|
||||||
|
assert_throws({'name': 'TypeError'}, function () { new SomeCustomButtonElement(); });
|
||||||
|
}, 'Custom element constructor must throw TypeError when it does not extend the proper element interface');
|
||||||
|
|
||||||
test(function () {
|
test(function () {
|
||||||
class CustomElementWithInferredTagName extends HTMLElement {};
|
class CustomElementWithInferredTagName extends HTMLElement {};
|
||||||
customElements.define('inferred-name', CustomElementWithInferredTagName);
|
customElements.define('inferred-name', CustomElementWithInferredTagName);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue