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_09_00_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/#html-el
ements-and-their-shadow-trees"> |
| 16 <meta name="assert" content="HTML Elements and Their Shadow Trees: Check that fi
eldset can contain at least two insertion points with matching criteria 'legend:
first-of-type' and 'universal selector'"> |
| 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 universal selector |
| 26 test(unit(function (ctx) { |
| 27 |
| 28 var d = newRenderedHTMLDocument(ctx); |
| 29 |
| 30 // create element |
| 31 var el = d.createElement('fieldset'); |
| 32 d.body.appendChild(el); |
| 33 |
| 34 el.innerHTML = '' + |
| 35 '<span id="shadow">This is a node that should be distributed</span>' + |
| 36 '<span id="flbk">This is a fallback content</span>'; |
| 37 |
| 38 var s = el.createShadowRoot(); |
| 39 s.innerHTML = '<content select="#shadow"></content>'; |
| 40 |
| 41 assert_true(d.querySelector('#shadow').offsetTop > 0, 'fieldset should allow
at least one insertion point'); |
| 42 assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shoul
dn\'t be rendered'); |
| 43 |
| 44 }), 'A_09_00_03_T01'); |
| 45 |
| 46 |
| 47 |
| 48 //test legend:first-of-type |
| 49 test(unit(function (ctx) { |
| 50 |
| 51 var d = newRenderedHTMLDocument(ctx); |
| 52 |
| 53 // create element |
| 54 var el = d.createElement('fieldset'); |
| 55 d.body.appendChild(el); |
| 56 |
| 57 el.innerHTML = '' + |
| 58 '<legend>' |
| 59 '<span id="shadow">This is a node that should be distributed</span>' + |
| 60 '</legend>' + |
| 61 '<span id="flbk">Unlucky content</span>'; |
| 62 |
| 63 var s = el.createShadowRoot(); |
| 64 s.innerHTML = '<content select="legend:first-of-type"></content>'; |
| 65 |
| 66 assert_true(d.querySelector('#shadow').offsetTop > 0, 'fieldset should allow
insertion point ' + |
| 67 'with legend:first-of-type matching criteria'); |
| 68 assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shoul
dn\'t be rendered'); |
| 69 |
| 70 }), 'A_09_00_03_T02'); |
| 71 </script> |
| 72 </body> |
| 73 </html> |
OLD | NEW |