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

Side by Side Diff: LayoutTests/imported/web-platform-tests/shadow-dom/shadow-trees/upper-boundary-encapsulation/dom-tree-accessors-002.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 <!--
3 Distributed under both the W3C Test Suite License [1] and the W3C
4 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
5 policies and contribution forms [3].
6
7 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
8 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
9 [3] http://www.w3.org/2004/10/27-testcases
10 -->
11 <html>
12 <head>
13 <title>Shadow DOM Test: Upper-boundary encapsulation: shadow root's DOM tree acc essors</title>
14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
15 <link rel="author" title="Mikhail Fursov" href="mailto:mfursov@unipro.ru">
16 <link rel="author" title="Yuta Kitamura" href="mailto:yutak@google.com">
17 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#upper-b oundary-encapsulation">
18 <meta name="assert" content="Upper-boundary encapsulation: The nodes are accessi ble using shadow root's DOM tree accessor methods.">
19 <script src="../../../../../resources/testharness.js"></script>
20 <script src="../../../../../resources/testharnessreport.js"></script>
21 <script src="../../testcommon.js"></script>
22 <link rel="stylesheet" href="../../../../../resources/testharness.css">
23 </head>
24 <body>
25 <div id="log"></div>
26 <script>
27 function assert_singleton_node_list(nodeList, expectedNode) {
28 assert_equals(nodeList.length, 1);
29 assert_equals(nodeList[0], expectedNode);
30 }
31
32 test(function () {
33 var doc = document.implementation.createHTMLDocument('Test');
34 var shadowRoot = doc.body.createShadowRoot();
35 var image = doc.createElement('img');
36 shadowRoot.appendChild(image);
37
38 assert_singleton_node_list(shadowRoot.getElementsByTagName('img'), image);
39 },
40 'Elements in a shadow tree should be accessible via shadow root\'s ' +
41 'getElementsByTagName() DOM tree accessor.'
42 );
43
44 test(function () {
45 var namespace = 'http://www.w3.org/1999/xhtml';
46 var doc = document.implementation.createDocument(namespace, 'html');
47 doc.documentElement.appendChild(doc.createElementNS(namespace, 'head'));
48 var body = doc.createElementNS(namespace, 'body');
49 var imageHost = doc.createElementNS(namespace, 'img');
50 body.appendChild(imageHost);
51 doc.documentElement.appendChild(body);
52
53 var shadowRoot = body.createShadowRoot();
54 var imageShadow = doc.createElementNS(namespace, 'img');
55 shadowRoot.appendChild(imageShadow);
56
57 assert_singleton_node_list(
58 shadowRoot.getElementsByTagNameNS(namespace, 'img'), imageShadow);
59 },
60 'Elements in a shadow tree should be accessible via shadow root\'s ' +
61 'getElementsByTagNameNS() DOM tree accessor.'
62 );
63
64 test(function () {
65 var doc = document.implementation.createHTMLDocument('Test');
66 var shadowRoot = doc.body.createShadowRoot();
67 var div = doc.createElement('div');
68 div.className = 'div-class';
69 shadowRoot.appendChild(div);
70
71 assert_singleton_node_list(
72 shadowRoot.getElementsByClassName('div-class'), div);
73 },
74 'Elements in a shadow tree should be accessible via shadow root\'s ' +
75 'getElementsByClassName() DOM tree accessor.'
76 );
77
78 test(function () {
79 var doc = document.implementation.createHTMLDocument('Test');
80 var shadowRoot = doc.body.createShadowRoot();
81 var div = doc.createElement('div');
82 div.id = 'div-id';
83 shadowRoot.appendChild(div);
84
85 assert_equals(shadowRoot.getElementById('div-id'), div);
86 },
87 'Elements in a shadow tree should be accessible via shadow root\'s ' +
88 'getElementById() DOM tree accessor.'
89 );
90 </script>
91 </body>
92 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698