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_07_02_01</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/#focus-n
avigation"> |
| 16 <meta name="assert" content="User Interaction: The navigation order within a sha
dow tree must be computed as a list of focusable elements in tree order as-rende
red"> |
| 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_07_02_01_T01 = async_test('A_07_02_01_T01'); |
| 26 |
| 27 A_07_02_01_T01.step(unit(function (ctx) { |
| 28 |
| 29 var counter = 0; |
| 30 |
| 31 var d = newRenderedHTMLDocument(ctx); |
| 32 |
| 33 var chb1 = d.createElement('input'); |
| 34 chb1.setAttribute('type', 'checkbox'); |
| 35 chb1.setAttribute('id', 'chb1'); |
| 36 chb1.addEventListener('focus', A_07_02_01_T01.step_func(function(event)
{ |
| 37 assert_equals(counter++, 0, 'Point 1: wrong focus navigation ord
er'); |
| 38 }), false); |
| 39 d.body.appendChild(chb1); |
| 40 |
| 41 var host = d.createElement('div'); |
| 42 d.body.appendChild(host); |
| 43 var s = host.createShadowRoot(); |
| 44 |
| 45 var inp1 = d.createElement('input'); |
| 46 inp1.setAttribute('type', 'text'); |
| 47 inp1.setAttribute('id', 'shInp1'); |
| 48 inp1.setAttribute('value', 'Input 1'); |
| 49 inp1.addEventListener('focus', A_07_02_01_T01.step_func(function(event)
{ |
| 50 assert_equals(counter++, 1, 'Point 2: wrong focus navigation ord
er'); |
| 51 }), false); |
| 52 s.appendChild(inp1); |
| 53 |
| 54 var inp2 = d.createElement('input'); |
| 55 inp2.setAttribute('type', 'text'); |
| 56 inp2.setAttribute('id', 'shInp2'); |
| 57 inp2.setAttribute('value', 'Input 2'); |
| 58 inp2.addEventListener('focus', A_07_02_01_T01.step_func(function(event)
{ |
| 59 assert_equals(counter++, 2, 'Point 3: wrong focus navigation ord
er'); |
| 60 }), false); |
| 61 s.appendChild(inp2); |
| 62 |
| 63 var chb2 = d.createElement('input'); |
| 64 chb2.setAttribute('type', 'checkbox'); |
| 65 chb2.setAttribute('id', 'chb2'); |
| 66 chb2.addEventListener('focus', A_07_02_01_T01.step_func(function(event)
{ |
| 67 assert_equals(counter++, 3, 'Point 4: wrong focus navigation ord
er'); |
| 68 }), false); |
| 69 d.body.appendChild(chb2); |
| 70 |
| 71 chb1.focus(); |
| 72 |
| 73 //simulate TAB clicks |
| 74 fireKeyboardEvent(d, chb1, 'U+0009'); |
| 75 |
| 76 fireKeyboardEvent(d, inp1, 'U+0009'); |
| 77 |
| 78 fireKeyboardEvent(d, inp2, 'U+0009'); |
| 79 |
| 80 fireKeyboardEvent(d, chb2, 'U+0009'); |
| 81 |
| 82 A_07_02_01_T01.done(); |
| 83 })); |
| 84 </script> |
| 85 </body> |
| 86 </html> |
OLD | NEW |