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

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

Issue 2321363002: Custom Elements: layout tests for custom built-in elements definition (Closed)
Patch Set: 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-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-element.html
diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/define-element.html b/third_party/WebKit/LayoutTests/custom-elements/spec/define-element.html
index ca3c310d29f87fd57cb8ce96fa2cb44683df5cdc..9185c40500062b838dd5d5faa589e97b4cfb1141 100644
--- a/third_party/WebKit/LayoutTests/custom-elements/spec/define-element.html
+++ b/third_party/WebKit/LayoutTests/custom-elements/spec/define-element.html
@@ -102,6 +102,51 @@ promise_test((t) => {
}, 'HTMLElement constructor looks up definitions in the current global-' +
'reused constructor');
+// TODO: What error should be thrown if extends option not specified or null?
dominicc (has gone to gerrit) 2016/09/12 05:12:54 Part of it is element definition [1] step 6. If th
+
+test_with_window((w) => {
+ class A extends w.HTMLButtonElement {}
+ let invalid_values = [
kojii 2016/09/12 04:52:23 Let's make the variable name more explicit; in thi
+ 'a-a',
+ 'z0-y0',
+ 'emotion-\u1f60d',
+ 'math-\u03b1',
+ 'a.b-c'
+ ];
+ invalid_values.forEach((val) => {
+ assert_throws_dom_exception(w, 'NotSupportedError', () => {
+ w.customElements.define('a-a', A, { extends: val });
+ }, 'extends value must not be valid customized element name')
dominicc (has gone to gerrit) 2016/09/12 05:12:54 It might be good to include the actual value in th
+ });
+}, 'Invalid extends value');
dominicc (has gone to gerrit) 2016/09/12 05:12:54 This and the next test may show up in output like
+
+test_with_window((w) => {
+ class A extends w.HTMLButtonElement {}
+ let invalid_values = [
kojii 2016/09/12 04:52:23 ditto; such as "element_names_for_HTMLUnknownEleme
+ 'bgsound',
+ 'blink',
+ 'isindex',
+ 'multicol',
+ 'nextid',
+ 'spacer',
+ 42
+ ]
+ invalid_values.forEach((val) => {
+ assert_throws_dom_exception(w, 'NotSupportedError', () => {
+ w.customElements.define('a-a', A, { extends: val });
+ }, 'extends value cannot be HTMLUnknownElement');
dominicc (has gone to gerrit) 2016/09/12 05:12:55 Make this more precise; the value isn't HTMLUnknow
+ });
+}, 'Invalid extends value');
+
+test_with_window((w) => {
+ class A extends w.HTMLButtonElement {}
+ w.customElements.define('defined-name', A, { extends: 'button'});
dominicc (has gone to gerrit) 2016/09/12 05:12:54 Be consistent with spacing; you put a space before
+ assert_equals(new A().localName, 'button', 'extends value should == local ' +
kojii 2016/09/12 04:52:23 Let's make human text; such as "localName should b
dominicc (has gone to gerrit) 2016/09/12 05:12:54 Use English, so not == but just 'be' or something
+ 'name');
+ assert_not_equals(new A().localName, 'defined-name', 'extends value ' +
kojii 2016/09/12 04:52:23 ditto.
+ 'should != defined-name');
+}, 'Localname should be extends value not defined-name');
dominicc (has gone to gerrit) 2016/09/12 05:12:54 Write 'Local name ...' with a space. localName is
+
promise_test((t) => {
return Promise.all([create_window_in_test(t), create_window_in_test(t)])
.then(([w1, w2]) => {
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-elements/spec/define-element-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698