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

Side by Side Diff: LayoutTests/imported/web-platform-tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003.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_03</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:When an insertion point or a shadow insertion point has nothing assigned or distributed to them, t he fallback content must be used instead 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_03_T1 = async_test('A_04_05_03_T01');
26
27 A_04_05_03_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_05_03_T1.step_func(function () {
33 try {
34 var d = iframe.contentDocument;
35 var ul = d.querySelector('ul.stories');
36
37 //make the oldest shadow subtree
38 var s1 = ul.createShadowRoot();
39 var subdiv1 = d.createElement('div');
40 subdiv1.innerHTML = '<ul><content select="#li1"></content></ul>';
41 s1.appendChild(subdiv1);
42
43 //make an old shadow subtree
44 var s2 = ul.createShadowRoot();
45 var subdiv2 = d.createElement('div');
46 subdiv2.innerHTML = '<ul><content select=".shadow"></content></ul>';
47 s2.appendChild(subdiv2);
48
49 //make the youngest shadow subtree
50 var s3 = ul.createShadowRoot();
51 var subdiv3 = d.createElement('div');
52 subdiv3.innerHTML = '<ul><content select=".shadow2"></content></ul>' +
53 '<shadow><span id="spn_first">The first span</span></shadow>' +
54 '<shadow><span id="spn_second">The second span</span></shadow>';
55
56 s3.appendChild(subdiv3);
57
58 //The order of DOM elements should be the following:
59 //li4, li3, li6 visible. Other elements invisible
60 assert_true(d.querySelector('#li4').offsetTop > 0,
61 'Only the younger tree should take part in the distribution');
62 assert_true(d.querySelector('#li3').offsetTop > d.querySelector('#li 4').offsetTop,
63 'Point 1: Older tree should take part in the distributio n');
64 assert_true(d.querySelector('#li6').offsetTop > d.querySelector('#li 3').offsetTop,
65 'Point 2: Older tree should take part in the distributio n');
66
67 assert_equals(d.querySelector('#li1').offsetTop, 0,
68 'The oldest tree shouldn\'t take part in the distribution');
69 assert_equals(d.querySelector('#li2').offsetTop, 0,
70 'Point 3: Elements that don\'t mach insertion point criteria par ticipate in distribution');
71 assert_equals(d.querySelector('#li5').offsetTop, 0,
72 'Point 4: Elements that don\'t mach insertion point criteria par ticipate in distribution');
73
74 //spn_first should be invisible, spn_second visible
75 assert_equals(s3.querySelector('#spn_first').offsetTop, 0,
76 'Shadow insertion point should be active');
77 assert_true(s3.querySelector('#spn_second').offsetTop > 0,
78 'Shadow insertion point should be inactive');
79
80 } finally {
81 iframe.parentNode.removeChild(iframe);
82 }
83 A_04_05_03_T1.done();
84 });
85 });
86 </script>
87 </body>
88 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698