| Index: third_party/WebKit/LayoutTests/custom-elements/spec/define-builtin-element.html
|
| diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/define-builtin-element.html b/third_party/WebKit/LayoutTests/custom-elements/spec/define-builtin-element.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3635a8bc1c31fa803b257d14903259a66fd3fdd6
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/custom-elements/spec/define-builtin-element.html
|
| @@ -0,0 +1,57 @@
|
| +<!DOCTYPE html>
|
| +<title>Custom Built-in Elements: define algorithm paths that are reached by customized built-in elements</title>
|
| +<link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#customelementsregistry">
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script src="resources/custom-elements-helpers.js"></script>
|
| +<body>
|
| +<script>
|
| +
|
| +'use strict';
|
| +
|
| +test_with_window((w) => {
|
| + class A extends w.HTMLButtonElement {}
|
| + let valid_custom_element_names = [
|
| + 'a-a',
|
| + 'z0-y0',
|
| + 'emotion-\u1f60d',
|
| + 'math-\u03b1',
|
| + 'a.b-c'
|
| + ];
|
| + valid_custom_element_names.forEach((val) => {
|
| + assert_throws_dom_exception(w, 'NotSupportedError', () => {
|
| + w.customElements.define('a-a', A, { extends: val });
|
| + }, `having valid custon element name element interface (${val}) ` +
|
| + 'for extends should throw a NotSupportedError')
|
| + });
|
| +}, 'Element interface for extends is not valid custom element name');
|
| +
|
| +test_with_window((w) => {
|
| + class A extends w.HTMLButtonElement {}
|
| + let HTMLUnknownElement_names = [
|
| + 'bgsound',
|
| + 'blink',
|
| + 'isindex',
|
| + 'multicol',
|
| + 'nextid',
|
| + 'spacer',
|
| + 42
|
| + ]
|
| + HTMLUnknownElement_names.forEach((val) => {
|
| + assert_throws_dom_exception(w, 'NotSupportedError', () => {
|
| + w.customElements.define('a-a', A, { extends: val });
|
| + }, `having element interface for extends (${val}) undefined in specs` +
|
| + ' should throw a NotSupportedError');
|
| + });
|
| +}, 'Element interface for extends defined in specification');
|
| +
|
| +test_with_window((w) => {
|
| + class A extends w.HTMLButtonElement {}
|
| + w.customElements.define('defined-name', A, { extends: 'button' });
|
| + assert_equals(new A().localName, 'button',
|
| + 'localName should be element interface for extends');
|
| + assert_not_equals(new A().localName, 'defined-name',
|
| + 'localName should not be defined-name');
|
| +}, 'localName set to element interface for extends');
|
| +</script>
|
| +</body>
|
|
|