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_01_02_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/#shadow-
root-methods"> |
| 16 <meta name="assert" content="ShadowRoot Object: NodeList getElementsByClassName(
DOMString className) method"> |
| 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(function () { |
| 26 |
| 27 var d = newHTMLDocument(); |
| 28 |
| 29 var el = d.createElement('div'); |
| 30 d.body.appendChild(el); |
| 31 |
| 32 var s = el.createShadowRoot(); |
| 33 |
| 34 assert_equals(s.getElementsByClassName('clazz').length, 0, 'ShadowRoot getEl
ementsByClassName() ' + |
| 35 'method should return empty list if there\'s no matching child e
lements'); |
| 36 |
| 37 }, 'A_10_01_02_02_T01'); |
| 38 |
| 39 |
| 40 |
| 41 test(function () { |
| 42 |
| 43 var d = newHTMLDocument(); |
| 44 |
| 45 var el = d.createElement('div'); |
| 46 d.body.appendChild(el); |
| 47 |
| 48 var s = el.createShadowRoot(); |
| 49 |
| 50 var child = d.createElement('span'); |
| 51 child.setAttribute('class', 'clazz'); |
| 52 s.appendChild(child); |
| 53 |
| 54 assert_equals(s.getElementsByClassName('clazz').length, 1, 'ShadowRoot getEl
ementsByClassName() ' + |
| 55 'method should return matching child element'); |
| 56 |
| 57 }, 'A_10_01_02_02_T02'); |
| 58 |
| 59 |
| 60 test(function () { |
| 61 |
| 62 var d = newHTMLDocument(); |
| 63 |
| 64 var el = d.createElement('div'); |
| 65 d.body.appendChild(el); |
| 66 |
| 67 var s = el.createShadowRoot(); |
| 68 |
| 69 var child = d.createElement('span'); |
| 70 child.setAttribute('class', 'clazz'); |
| 71 s.appendChild(child); |
| 72 |
| 73 var child2 = d.createElement('span'); |
| 74 child2.setAttribute('class', 'clazz'); |
| 75 s.appendChild(child2); |
| 76 |
| 77 assert_equals(s.getElementsByClassName('clazz').length, 2, 'ShadowRoot getEl
ementsByClassName() ' + |
| 78 'method should return matching child elements'); |
| 79 |
| 80 }, 'A_10_01_02_02_T03'); |
| 81 </script> |
| 82 </body> |
| 83 </html> |
OLD | NEW |