Index: third_party/WebKit/LayoutTests/custom-elements/spec/when-defined-invalid-name.html |
diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/when-defined-invalid-name.html b/third_party/WebKit/LayoutTests/custom-elements/spec/when-defined-invalid-name.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1849bcbc80a346ec858fd1ec03f9052c01d093c1 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/custom-elements/spec/when-defined-invalid-name.html |
@@ -0,0 +1,40 @@ |
+<!DOCTYPE html> |
+<title>Custom Elements: whenDefined with invalid name</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharness-helpers.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="resources/custom-elements-helpers.js"></script> |
+<body> |
+<script> |
+ |
+'use strict'; |
+ |
+test_with_window((w) => { |
+ // https://html.spec.whatwg.org/multipage/scripting.html#valid-custom-element-name |
+ let invalid_names = [ |
+ 'annotation-xml', |
+ 'color-profile', |
+ 'font-face', |
+ 'font-face-src', |
+ 'font-face-uri', |
+ 'font-face-format', |
+ 'font-face-name', |
+ 'missing-glyph', |
+ 'div', 'p', |
+ 'nothtmlbutnohyphen', |
+ '-not-initial-a-z', '0not-initial-a-z', 'Not-initial-a-z', |
+ 'intermediate-UPPERCASE-letters', |
+ 'bad-\u00b6', 'bad-\u00b8', 'bad-\u00bf', 'bad-\u00d7', 'bad-\u00f7', |
+ 'bad-\u037e', 'bad-\u037e', 'bad-\u2000', 'bad-\u200e', 'bad-\u203e', |
+ 'bad-\u2041', 'bad-\u206f', 'bad-\u2190', 'bad-\u2bff', 'bad-\u2ff0', |
+ 'bad-\u3000', 'bad-\ud800', 'bad-\uf8ff', 'bad-\ufdd0', 'bad-\ufdef', |
+ 'bad-\ufffe', 'bad-\uffff', 'bad-' + String.fromCodePoint(0xf0000) |
+ ]; |
+ invalid_names.forEach((name) => { |
+ promise_test((t) => { |
+ return promise_rejects(t, new SyntaxError(), w.customElements.whenDefined(name)); |
kojii
2016/06/28 04:26:00
s/new SyntaxError()/'SYNTAX_ERR'/
"new SyntaxErro
|
+ }); |
+ }); |
+}, 'calling whenDefined() with invalid names should return rejected promise'); |
+</script> |
+</body> |