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

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..a149676db2006980b3bba19106305c1f13429267
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/custom-elements/spec/define-builtin-element.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<title>Custom Builtin Elements: defineElement</title>
dominicc (has gone to gerrit) 2016/09/13 08:22:45 Let's use a more specific 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>
+// An addition to define-element.html for paths taken for builtin elements
+// These aren't implemented yet
dominicc (has gone to gerrit) 2016/09/13 08:22:45 Scratch this comment; the -expected.txt file will
+
+'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 + ') ' +
dominicc (has gone to gerrit) 2016/09/13 08:22:45 You can use `... ${val} ...` for more succinct str
+ '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