Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/spec/define-builtin-element.html

Issue 2321363002: Custom Elements: layout tests for custom built-in elements definition (Closed)
Patch Set: New file for custom built-in element definition Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-elements/spec/define-builtin-element-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-elements/spec/define-builtin-element-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698