col-wrap-only.html (2242B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML Test: focusgroup - Validate that col-wrap allows only vertical wrapping.</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 col-wrap"> 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 r1c3 = document.getElementById("r1c3"); 30 31 await focusAndKeyPress(r1c3, kArrowRight); 32 assert_equals(document.activeElement, r1c3); 33 }, "A right arrow press should not wrap the focus to the first column when only vertical wrap is supported by the focusgroup."); 34 35 promise_test(async t => { 36 var r1c1 = document.getElementById("r1c1"); 37 var r2c1 = document.getElementById("r2c1"); 38 39 await focusAndKeyPress(r2c1, kArrowDown); 40 assert_equals(document.activeElement, r1c1); 41 }, "When on the last row, a down arrow press should move the focus to first row if the focusgroup wraps vertically."); 42 43 promise_test(async t => { 44 var r1c1 = document.getElementById("r1c1"); 45 46 await focusAndKeyPress(r1c1, kArrowLeft); 47 assert_equals(document.activeElement, r1c1); 48 }, "A left arrow press should not wrap the focus to the last column when only vertical wrap is supported by the focusgroup."); 49 50 promise_test(async t => { 51 var r1c1 = document.getElementById("r1c1"); 52 var r2c1 = document.getElementById("r2c1"); 53 54 await focusAndKeyPress(r1c1, kArrowUp); 55 assert_equals(document.activeElement, r2c1); 56 }, "When on the first row, an up arrow press should move the focus to last row if the focusgroup wraps vertically."); 57 58 </script>