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

Side by Side Diff: LayoutTests/imported/web-platform-tests/custom-elements/instantiating-custom-elements/custom-element-constructor-is-attribute.html

Issue 560893005: First checked-in import of the W3C's test suites. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add new expectations for newly failing w3c tests Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Custom element constructor sets value of IS attribute to custom element t ype, if it is not equal to name</title>
5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
6 <meta name="assert" content="If TYPE is not the same as NAME, set the value of E LEMENT's IS attribute to TYPE">
7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#instantiating-custo m-elements">
8 <script src="../../../../resources/testharness.js"></script>
9 <script src="../../../../resources/testharnessreport.js"></script>
10 <script src="../testcommon.js"></script>
11 <link rel="stylesheet" href="../../../../resources/testharness.css">
12 </head>
13 <body>
14 <div id="log"></div>
15 <script>
16 test(function() {
17 var doc = newHTMLDocument();
18 HTML5_ELEMENTS.forEach(function(tagName) {
19 if (HTML5_DOCUMENT_ELEMENTS.indexOf(tagName) !== -1) {
20 return;
21 }
22 var obj = doc.createElement(tagName);
23 var name = 'x-a-' + tagName;
24 var proto = Object.create(obj.constructor.prototype);
25 var GeneratedConstructor = doc.registerElement(name, {prototype: proto, extends: tagName});
26 var customElement = new GeneratedConstructor();
27
28 assert_equals(customElement.getAttribute('is'), name,
29 'Value of the IS attribute should be set to type');
30 });
31 }, 'Test that the constructor of a type extension sets the IS attribute value to the type');
32
33
34 test(function() {
35 var doc = newHTMLDocument();
36 HTML5_ELEMENTS.forEach(function(tagName) {
37 if (HTML5_DOCUMENT_ELEMENTS.indexOf(tagName) !== -1) {
38 return;
39 }
40 var name = 'x-b-' + tagName;
41 var GeneratedConstructor = doc.registerElement(name);
42 var customElement = new GeneratedConstructor();
43
44 assert_false(customElement.hasAttribute('is'),
45 'IS attribute should not present if local name is the same as type') ;
46 });
47 }, 'Test that the constructor of a custom element does not set the IS attribute if local name is the same as type');
48 </script>
49 </body>
50 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698