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_06_00_09</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/#styles"
> |
| 16 <meta name="assert" content="Styles:the styles of the shadow host are inherited
by the children of the shadow root"> |
| 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 var d = newRenderedHTMLDocument(ctx); |
| 27 |
| 28 d.body.innerHTML = '' + |
| 29 '<div id="shHost" style="font-size:10px">' + |
| 30 '<span id="spn1">This is a shadow host child</span>' + |
| 31 '</div>'; |
| 32 |
| 33 var host = d.querySelector('#shHost'); |
| 34 |
| 35 var s = host.createShadowRoot(); |
| 36 |
| 37 var div = d.createElement('div'); |
| 38 div.innerHTML ='<span id="spn2">This is a shadow root child</span>'; |
| 39 s.appendChild(div); |
| 40 |
| 41 assert_equals(d.querySelector('#spn1').offsetTop, 0, |
| 42 'Element should not be rendered'); |
| 43 assert_true(s.querySelector('#spn2').offsetTop > 0, |
| 44 'Element should be rendered'); |
| 45 |
| 46 var oldHeight = s.querySelector('#spn2').offsetHeight; |
| 47 |
| 48 host.setAttribute('style', 'font-size:20px'); |
| 49 |
| 50 assert_true(s.querySelector('#spn2').offsetHeight > oldHeight, |
| 51 'Shadow host style must be aplied to the shadow root children'); |
| 52 |
| 53 }), 'A_06_00_09_T01'); |
| 54 |
| 55 |
| 56 |
| 57 |
| 58 test(unit(function (ctx) { |
| 59 var d = newRenderedHTMLDocument(ctx); |
| 60 |
| 61 d.body.innerHTML = |
| 62 '<ul class="cls" style="font-size: 10px">' + |
| 63 '<li id="li1" class="shadow">1</li>' + |
| 64 '<li id="li2" class="shadow2">2</li>' + |
| 65 '<li id="li3" class="shadow">3</li>' + |
| 66 '<li id="li4">4</li>' + |
| 67 '<li id="li5" class="shadow">5</li>' + |
| 68 '<li id="li6" class="shadow2">6</li>' + |
| 69 '</ul>'; |
| 70 |
| 71 var host = d.querySelector('.cls'); |
| 72 //Shadow root to play with |
| 73 var s = host.createShadowRoot(); |
| 74 |
| 75 var div = d.createElement('div'); |
| 76 div.innerHTML ='<ul><content select=".shadow"></content></ul>'; |
| 77 s.appendChild(div); |
| 78 |
| 79 var height1 = d.querySelector('#li1').offsetHeight; |
| 80 var height3 = d.querySelector('#li3').offsetHeight; |
| 81 var height5 = d.querySelector('#li5').offsetHeight; |
| 82 |
| 83 host.setAttribute('style', 'font-size: 20px'); |
| 84 |
| 85 assert_true(d.querySelector('#li1').offsetHeight > height1, |
| 86 'Point 1: Shadow host style must be aplied to the shadow root ch
ildren'); |
| 87 assert_true(d.querySelector('#li3').offsetHeight > height3, |
| 88 'Point 2: Shadow host style must be aplied to the shadow root ch
ildren'); |
| 89 assert_true(d.querySelector('#li5').offsetHeight > height5, |
| 90 'Point 3: Shadow host style must be aplied to the shadow root ch
ildren'); |
| 91 |
| 92 |
| 93 }), 'A_06_00_09_T02'); |
| 94 </script> |
| 95 </body> |
| 96 </html> |
OLD | NEW |