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

Side by Side Diff: LayoutTests/imported/web-platform-tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html

Issue 1236713002: Import FileAPI tests from web-platform-tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ugh, stupid baselines Created 5 years, 5 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_05_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/#multipl e-shadow-subtrees">
16 <meta name="assert" content="Hosting Multiple Shadow Subtrees:The shadow inserti on point designates a place in the shadow DOM subtree, where an older tree is in serted when rendering">
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_05_01_T1 = async_test('A_04_05_01_T01');
26
27
28 // Check that only the younger tree is visible if there's no shadow insertion po int
29 A_04_05_01_T1.step(function () {
30 var iframe = document.createElement('iframe');
31 iframe.src = '../../resources/bobs_page.html';
32 document.body.appendChild(iframe);
33
34 iframe.onload = A_04_05_01_T1.step_func(function () {
35 try {
36 var d = iframe.contentDocument;
37 var ul = d.querySelector('ul.stories');
38
39 //make old shadow subtree
40 var s1 = ul.createShadowRoot();
41 var subdiv1 = d.createElement('div');
42 subdiv1.innerHTML = '<ul><content select=".shadow"></content></ul>';
43 s1.appendChild(subdiv1);
44
45 //make younger shadow subtree
46 var s2 = ul.createShadowRoot();
47 var subdiv2 = d.createElement('div');
48 subdiv2.innerHTML = '<ul><content select=".shadow2"></content></ul>' ;
49 s2.appendChild(subdiv2);
50
51 //The order of DOM elements should be the following:
52 //li4 visible. Other elements invisible
53 assert_true(d.querySelector('#li4').offsetTop > 0,
54 'Only the younger tree should take part in the distribution');
55
56 assert_equals(d.querySelector('#li1').offsetTop, 0,
57 'Point 1: Elements that don\'t mach insertion point criteria par ticipate in distribution');
58 assert_equals(d.querySelector('#li2').offsetTop, 0,
59 'Point 2: Elements that don\'t mach insertion point criteria par ticipate in distribution');
60 assert_equals(d.querySelector('#li3').offsetTop, 0,
61 'Point 3: Elements that don\'t mach insertion point criteria par ticipate in distribution');
62 assert_equals(d.querySelector('#li5').offsetTop, 0,
63 'Point 4: Elements that don\'t mach insertion point criteria par ticipate in distribution');
64 assert_equals(d.querySelector('#li6').offsetTop, 0,
65 'Point 5: Elements that don\'t mach insertion point criteria par ticipate in distribution');
66
67 } finally {
68 iframe.parentNode.removeChild(iframe);
69 }
70 A_04_05_01_T1.done();
71 });
72 });
73
74
75
76 //Check that both the younger tree and the older one are visible
77 //if there's a shadow insertion point for the older tree
78 var A_04_05_01_T2 = async_test('A_04_05_01_T02');
79
80 A_04_05_01_T2.step(function () {
81 var iframe = document.createElement('iframe');
82 iframe.src = '../../resources/bobs_page.html';
83 document.body.appendChild(iframe);
84
85 iframe.onload = A_04_05_01_T2.step_func(function () {
86 try {
87 var d = iframe.contentDocument;
88 var ul = d.querySelector('ul.stories');
89
90 //make old shadow subtree
91 var s1 = ul.createShadowRoot();
92 var subdiv1 = d.createElement('div');
93 subdiv1.innerHTML = '<ul><content select=".shadow"></content></ul>';
94 s1.appendChild(subdiv1);
95
96 //make younger shadow subtree
97 var s2 = ul.createShadowRoot();
98 var subdiv2 = d.createElement('div');
99 subdiv2.innerHTML = '<ul><content select=".shadow2"></content></ul>' ;
100 s2.appendChild(subdiv2);
101
102 //add a shadow insertion point for the older tree
103 s2.appendChild(d.createElement('shadow'));
104
105 //The order of DOM elements should be the following:
106 //li4, li3, li6 visible. Other elements invisible
107 assert_true(d.querySelector('#li4').offsetTop > 0,
108 'Younger tree should take part in the distribution');
109 assert_true(d.querySelector('#li3').offsetTop > d.querySelector('#li 4').offsetTop,
110 'Point 1: Older tree should take part in the distribution');
111 assert_true(d.querySelector('#li6').offsetTop > d.querySelector('#li 3').offsetTop,
112 'Point 2: Older tree should take part in the distribution');
113
114 assert_equals(d.querySelector('#li1').offsetTop, 0,
115 'Point 3: Elements that don\'t mach insertion point criteria par ticipate in distribution');
116 assert_equals(d.querySelector('#li2').offsetTop, 0,
117 'Point 4: Elements that don\'t mach insertion point criteria par ticipate in distribution');
118 assert_equals(d.querySelector('#li5').offsetTop, 0,
119 'Point 5: Elements that don\'t mach insertion point criteria par ticipate in distribution');
120 } finally {
121 iframe.parentNode.removeChild(iframe);
122 }
123 A_04_05_01_T2.done();
124 });
125 });
126 </script>
127 </body>
128 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698