OLD | NEW |
(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_10_04_02</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/#content
-element"> |
| 16 <meta name="assert" content="The content HTML element: select attribute"> |
| 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 test(unit(function (ctx) { |
| 26 |
| 27 var d = newRenderedHTMLDocument(ctx); |
| 28 |
| 29 d.body.innerHTML = |
| 30 '<ul class="cls">' + |
| 31 '<li id="li1" class="shadow">1</li>' + |
| 32 '<li id="li2" class="shadow2">2</li>' + |
| 33 '<li id="li3" class="shadow">3</li>' + |
| 34 '<li id="li4">4</li>' + |
| 35 '<li id="li5" class="shadow">5</li>' + |
| 36 '<li id="li6" class="shadow2">6</li>' + |
| 37 '</ul>'; |
| 38 |
| 39 var host = d.querySelector('.cls'); |
| 40 //Shadow root to play with |
| 41 var s = host.createShadowRoot(); |
| 42 |
| 43 var div = d.createElement('div'); |
| 44 div.innerHTML = '' + |
| 45 '<ul><content select=".shadow"><span id="spandex">This is fallback conte
nt</span></content></ul>'; |
| 46 s.appendChild(div); |
| 47 |
| 48 assert_equals(s.querySelector('#spandex').offsetTop, 0, 'Fallback content sh
ould not be rendered'); |
| 49 |
| 50 assert_equals(d.querySelector('#li2').offsetTop, 0, 'Point 1: Element should
not be rendered'); |
| 51 assert_equals(d.querySelector('#li4').offsetTop, 0, 'Point 2: Element should
not be rendered'); |
| 52 assert_equals(d.querySelector('#li6').offsetTop, 0, 'Point 3: Element should
not be rendered'); |
| 53 |
| 54 assert_true(d.querySelector('#li1').offsetTop > 0, 'Point 11: Element should
be rendered'); |
| 55 assert_true(d.querySelector('#li3').offsetTop > 0, 'Point 12: Element should
be rendered'); |
| 56 assert_true(d.querySelector('#li5').offsetTop > 0, 'Point 13: Element should
be rendered'); |
| 57 |
| 58 }), 'A_10_04_02_T01_01'); |
| 59 |
| 60 |
| 61 |
| 62 test(unit(function (ctx) { |
| 63 |
| 64 var d = newRenderedHTMLDocument(ctx); |
| 65 |
| 66 d.body.innerHTML = |
| 67 '<ul class="cls">' + |
| 68 '<li id="li1" class="shadow">1</li>' + |
| 69 '<li id="li2" class="shadow2">2</li>' + |
| 70 '<li id="li3" class="shadow">3</li>' + |
| 71 '<li id="li4">4</li>' + |
| 72 '<li id="li5" class="shadow">5</li>' + |
| 73 '<li id="li6" class="shadow2">6</li>' + |
| 74 '</ul>'; |
| 75 |
| 76 var host = d.querySelector('.cls'); |
| 77 //Shadow root to play with |
| 78 var s = host.createShadowRoot(); |
| 79 |
| 80 var div = d.createElement('div'); |
| 81 div.innerHTML = '' + |
| 82 '<ul><content select=".shadow, #li4"><span id="spandex">This is fallback
content</span></content></ul>'; |
| 83 s.appendChild(div); |
| 84 |
| 85 assert_equals(s.querySelector('#spandex').offsetTop, 0, 'Fallback content sh
ould not be rendered'); |
| 86 |
| 87 assert_equals(d.querySelector('#li2').offsetTop, 0, 'Point 1: Element should
not be rendered'); |
| 88 assert_equals(d.querySelector('#li6').offsetTop, 0, 'Point 2: Element should
not be rendered'); |
| 89 |
| 90 assert_true(d.querySelector('#li1').offsetTop > 0, 'Point 11: Element should
be rendered'); |
| 91 assert_true(d.querySelector('#li3').offsetTop > 0, 'Point 12: Element should
be rendered'); |
| 92 assert_true(d.querySelector('#li5').offsetTop > 0, 'Point 13: Element should
be rendered'); |
| 93 assert_true(d.querySelector('#li4').offsetTop > 0, 'Point 14: Element should
be rendered'); |
| 94 |
| 95 }), 'A_10_04_02_T01_02'); |
| 96 </script> |
| 97 </body> |
| 98 </html> |
OLD | NEW |