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

Side by Side Diff: LayoutTests/imported/web-platform-tests/custom-elements/instantiating-custom-elements/extensions-to-document-interface/created-callback-create-element.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>Document.createElement() must enqueue created callback for registered cus tom element type</title>
5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
6 <meta name="assert" content="Document.createElement() must enqueue created callb ack for registered custom element type">
7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#extensions-to-docum ent-interface-to-instantiate">
8 <link rel="help" href="http://www.w3.org/TR/custom-elements/#types-of-callbacks" >
9 <script src="../../../../../resources/testharness.js"></script>
10 <script src="../../../../../resources/testharnessreport.js"></script>
11 <script src="../../testcommon.js"></script>
12 <link rel="stylesheet" href="../../../../../resources/testharness.css">
13 </head>
14 <body>
15 <div id="log"></div>
16 <script>
17 test(function() {
18 var doc = newHTMLDocument();
19 var proto = newHTMLElementPrototype();
20 var name = 'x-a';
21
22 doc.registerElement(name, {prototype: proto});
23 var customElement = doc.createElement(name);
24 assert_equals(proto.createdCallbackCalledCounter, 1,
25 'Callback created should be enqueued by Document.createElement()');
26 }, 'Test Document.createElement() without typeExtension argument enqueues create d callback');
27
28
29 test(function() {
30 var doc = newHTMLDocument();
31 var proto = newHTMLElementPrototype();
32 var name = 'x-b';
33
34 doc.registerElement(name, {prototype: proto});
35 var customElement = doc.createElement(name, name);
36 assert_equals(proto.createdCallbackCalledCounter, 1,
37 'Callback created should be enqueued by Document.createElement()');
38 }, 'Test Document.createElement() with typeExtension argument enqueues created c allback');
39
40
41 test(function() {
42 var doc = newHTMLDocument();
43 var proto = newHTMLElementPrototype();
44 var name = 'x-c';
45 var customElement = doc.createElement(name);
46 assert_equals(proto.createdCallbackCalledCounter, 0,
47 'Document.createElement() should not enqueue created callback ' +
48 'for unresolved custom element');
49
50 doc.registerElement(name, {prototype: proto});
51 assert_equals(proto.createdCallbackCalledCounter, 1,
52 'Callback created should be called after custom element is registered');
53 }, 'Document.createElement() should not enqueue created callback ' +
54 'for unresolved custom element');
55
56
57 test(function() {
58 var doc = newHTMLDocument();
59 HTML5_ELEMENTS.forEach(function(tagName) {
60 var obj = doc.createElement(tagName);
61 var name = 'x-d-' + tagName;
62 var proto = newCustomElementPrototype(Object.create(obj.constructor.prot otype));
63 doc.registerElement(name, {prototype: proto, extends: tagName});
64 var customElement = doc.createElement(tagName, name);
65
66 assert_equals(proto.createdCallbackCalledCounter, 1,
67 'Callback created should be enqueued by Document.createElement()');
68 });
69 }, 'Test Document.createElement() enqueues created callback for custom elements ' +
70 'that are extensions of HTML5 elements');
71 </script>
72 </body>
73 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698