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

Side by Side Diff: LayoutTests/imported/web-platform-tests/shadow-dom/shadow-trees/nested-shadow-trees/test-001.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: A_04_08_01</title>
14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
15 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#nested- shadow-subtrees">
16 <meta name="assert" content="Nested Shadow Subtrees:Any element in a shadow tree can be a shadow host, thus producing nested shadow trees">
17 <script src="../../../../../resources/testharness.js"></script>
18 <script src="../../../../../resources/testharnessreport.js"></script>
19 <script src="../../testcommon.js"></script>
20 <link rel="stylesheet" href="../../../../../resources/testharness.css">
21 </head>
22 <body>
23 <div id="log"></div>
24 <script>
25 var A_04_08_01_T1 = async_test('A_04_08_01_T01');
26
27 A_04_08_01_T1.step(function () {
28 var iframe = document.createElement('iframe');
29 iframe.src = '../../resources/bobs_page.html';
30 document.body.appendChild(iframe);
31
32 iframe.onload = A_04_08_01_T1.step_func(function () {
33 try {
34 var d = iframe.contentDocument;
35 var ul = d.querySelector('ul.stories');
36
37 //make a shadow subtree
38 var s1 = ul.createShadowRoot();
39 var subdiv1 = d.createElement('div');
40 subdiv1.innerHTML = '<ul><content select=".shadow"></content></ul>' +
41 '<div id="host_div">' +
42 '<span id="sh_span">This span should be visible</span>' +
43 '<ul id="host">' +
44 '<li id="sh_li1">Shadow li 1</li>' +
45 '<li id="sh_li2">Shadow li 2</li>' +
46 '<li id="sh_li3" class="shadow2">Shadow li 3</li >' +
47 '<li id="sh_li4">Shadow li 4</li>' +
48 '<li id="sh_li5">Shadow li 5</li>' +
49 '</ul>' +
50 '</div>';
51 s1.appendChild(subdiv1);
52
53 //make nested shadow subtree
54 var sh_ul = s1.querySelector('#host');
55 var s2 = sh_ul.createShadowRoot();
56 var subdiv2 = d.createElement('div');
57 subdiv2.innerHTML = '<ul><content select=".shadow2"></content></ul>' ;
58 s2.appendChild(subdiv2);
59
60 //The order of DOM elements should be the following:
61 //li4, li3 and sh_li3 visible. Other elements invisible
62 assert_true(d.querySelector('#li3').offsetTop > 0,
63 'Point 1: Shadow tree should take part in the distribution');
64 assert_true(d.querySelector('#li6').offsetTop > d.querySelector('#li 3').offsetTop,
65 'Point 2: Shadow tree should take part in the distribution');
66 assert_true(s1.querySelector('#sh_li3').offsetTop > 0,
67 'Nested shadow subtree should take part in the distribution');
68
69 assert_equals(d.querySelector('#li1').offsetTop, 0,
70 'Point 3: Elements that don\'t mach insertion point criteria par ticipate in distribution');
71 assert_equals(d.querySelector('#li2').offsetTop, 0,
72 'Point 4: Elements that don\'t mach insertion point criteria par ticipate in distribution');
73 assert_equals(d.querySelector('#li4').offsetTop, 0,
74 'Point 5: Elements that don\'t mach insertion point criteria par ticipate in distribution');
75 assert_equals(d.querySelector('#li5').offsetTop, 0,
76 'Point 6: Elements that don\'t mach insertion point criteria par ticipate in distribution');
77
78 assert_equals(s1.querySelector('#sh_li1').offsetTop, 0,
79 'Point 7: Elements of the nested shadow subtree that don\'t mach insertion point criteria participate in distribution');
80 assert_equals(s1.querySelector('#sh_li2').offsetTop, 0,
81 'Point 8: Elements of the nested shadow subtree that don\'t mach insertion point criteria participate in distribution');
82 assert_equals(s1.querySelector('#sh_li4').offsetTop, 0,
83 'Point 9: Elements of the nested shadow subtree that don \'t mach insertion point criteria participate in distribution');
84 assert_equals(s1.querySelector('#sh_li5').offsetTop, 0,
85 'Point 10: Elements of the nested shadow subtree that do n\'t mach insertion point criteria participate in distribution');
86
87 assert_true(s1.querySelector('#sh_span').offsetTop > 0,
88 'Shadow subtree elements that are not shadow host should take pa rt in the distribution');
89
90
91 } finally {
92 iframe.parentNode.removeChild(iframe);
93 }
94 A_04_08_01_T1.done();
95 });
96 });
97 </script>
98 </body>
99 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698