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

Side by Side Diff: LayoutTests/imported/web-platform-tests/custom-elements/custom-element-lifecycle/enqueuing-and-invoking-callbacks/invoke-callbacks.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>Invoke CALLBACK with ELEMENT as callback this value</title>
5 <meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru ">
6 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
7 <meta name="assert" content="Invoke CALLBACK with ELEMENT as callback this value ">
8 <link rel="help" href="http://www.w3.org/TR/custom-elements/#enqueuing-and-invok ing-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 GeneratedConstructor = doc.registerElement('x-a', {prototype: proto});
21 var customElement = new GeneratedConstructor();
22
23 doc.body.innerHTML = '<x-a id="x-a"></x-a>';
24 assert_equals(doc.querySelector('#x-a'), proto.createdCallbackThis,
25 '\'this\' value of the created callback should be the custom element');
26 }, 'Test \'this\' value inside created callback.');
27
28
29 testInIFrame('../../resources/x-element.html', function(doc) {
30 var proto = newHTMLElementPrototype();
31 doc.registerElement('x-element', {prototype: proto});
32
33 assert_equals(doc.querySelector('#x-element'), proto.attachedCallbackThis,
34 '\'this\' value of the attached callback should be the custom element');
35 }, 'Test \'this\' value inside attached callback.');
36
37
38 testInIFrame('../../resources/x-element.html', function(doc) {
39 var proto = newHTMLElementPrototype();
40 doc.registerElement('x-element', {prototype: proto});
41
42 var customElement = doc.querySelector('#x-element');
43 doc.body.removeChild(customElement);
44 assert_equals(customElement, proto.detachedCallbackThis,
45 '\'this\' value of the detached callback should be the custom element');
46 }, 'Test \'this\' value inside detached callback.');
47
48
49 test(function() {
50 var doc = newHTMLDocument();
51 var proto = newHTMLElementPrototype();
52 var GeneratedConstructor = doc.registerElement('x-b', {prototype: proto});
53 var customElement = new GeneratedConstructor();
54
55 customElement.setAttribute('class', 'someClass');
56 assert_equals(customElement, proto.attributeChangedCallbackThis,
57 '\'this\' value of the attributeChanged callback should be the custom el ement');
58 }, 'Test \'this\' value inside attributeChanged callback.');
59 </script>
60 </body>
61 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698