simple-case.html (2077B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML Test: focusgroup - Simple case with grid focusgroup</title> 4 <link rel="author" title="Microsoft" href="http://www.microsoft.com/"> 5 <link rel="help" href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Focusgroup/explainer.md"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <script src="/resources/testdriver-actions.js"></script> 11 <script src="../resources/focusgroup-utils.js"></script> 12 13 <table focusgroup=grid> 14 <tr> 15 <td id=r1c1 tabindex=0>r1c1</td> 16 <td id=r1c2 tabindex=0>r1c2</td> 17 <td id=r1c3 tabindex=0>r1c3</td> 18 </tr> 19 <tr> 20 <td id=r2c1 tabindex=0>r2c1</td> 21 <td id=r2c2 tabindex=0>r2c2</td> 22 <td id=r2c3 tabindex=0>r2c3</td> 23 </tr> 24 </table> 25 26 <script> 27 28 promise_test(async t => { 29 var r1c1 = document.getElementById("r1c1"); 30 var r1c2 = document.getElementById("r1c2"); 31 32 await focusAndKeyPress(r1c1, kArrowRight); 33 assert_equals(document.activeElement, r1c2); 34 }, "A right arrow press should move the focus to the next column."); 35 36 promise_test(async t => { 37 var r1c1 = document.getElementById("r1c1"); 38 var r2c1 = document.getElementById("r2c1"); 39 40 await focusAndKeyPress(r1c1, kArrowDown); 41 assert_equals(document.activeElement, r2c1); 42 }, "A down arrow press should move the focus to the next row."); 43 44 promise_test(async t => { 45 var r1c1 = document.getElementById("r1c1"); 46 var r1c2 = document.getElementById("r1c2"); 47 48 await focusAndKeyPress(r1c2, kArrowLeft); 49 assert_equals(document.activeElement, r1c1); 50 }, "A left arrow press should move to the previous column."); 51 52 promise_test(async t => { 53 var r1c1 = document.getElementById("r1c1"); 54 var r2c1 = document.getElementById("r2c1"); 55 56 await focusAndKeyPress(r2c1, kArrowUp); 57 assert_equals(document.activeElement, r1c1); 58 }, "An up arrow press should move the focus to the previous row."); 59 60 </script>