Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=410052 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>nsIAccesible selection methods testing for ARIA grid</title> |
michael@0 | 8 | <link rel="stylesheet" type="text/css" |
michael@0 | 9 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 10 | |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 13 | |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../common.js"></script> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../role.js"></script> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../states.js"></script> |
michael@0 | 20 | <script type="application/javascript" |
michael@0 | 21 | src="../table.js"></script> |
michael@0 | 22 | |
michael@0 | 23 | <script type="application/javascript"> |
michael@0 | 24 | function doTest() |
michael@0 | 25 | { |
michael@0 | 26 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 27 | // ARIA grid |
michael@0 | 28 | var cellsArray = |
michael@0 | 29 | [ |
michael@0 | 30 | [ true, true, false, true], |
michael@0 | 31 | [ true, false, true, true], |
michael@0 | 32 | [ true, false, false, true], |
michael@0 | 33 | [ true, true, true, true], |
michael@0 | 34 | [ true, true, true, true] |
michael@0 | 35 | ]; |
michael@0 | 36 | |
michael@0 | 37 | testTableSelection("table", cellsArray); |
michael@0 | 38 | testUnselectTableColumn("table", 3, cellsArray); |
michael@0 | 39 | testUnselectTableRow("table", 3, cellsArray); |
michael@0 | 40 | testSelectTableColumn("table", 0, cellsArray); |
michael@0 | 41 | testSelectTableRow("table", 0, cellsArray); |
michael@0 | 42 | |
michael@0 | 43 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 44 | // a bit crazy ARIA grid |
michael@0 | 45 | cellsArray = |
michael@0 | 46 | [ |
michael@0 | 47 | [ false, false], |
michael@0 | 48 | [ false, false] |
michael@0 | 49 | ]; |
michael@0 | 50 | |
michael@0 | 51 | testTableSelection("grid2", cellsArray); |
michael@0 | 52 | testSelectTableColumn("grid2", 0, cellsArray); |
michael@0 | 53 | testSelectTableRow("grid2", 0, cellsArray); |
michael@0 | 54 | testUnselectTableColumn("grid2", 0, cellsArray); |
michael@0 | 55 | testUnselectTableRow("grid2", 0, cellsArray); |
michael@0 | 56 | |
michael@0 | 57 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 58 | // ARIA grid (column and row headers) |
michael@0 | 59 | |
michael@0 | 60 | cellsArray = |
michael@0 | 61 | [ |
michael@0 | 62 | [ undefined, true, false], |
michael@0 | 63 | [ undefined, true, false] |
michael@0 | 64 | ]; |
michael@0 | 65 | |
michael@0 | 66 | testTableSelection("grid3", cellsArray); |
michael@0 | 67 | testSelectTableColumn("grid3", 0, cellsArray); |
michael@0 | 68 | testSelectTableRow("grid3", 0, cellsArray); |
michael@0 | 69 | testUnselectTableColumn("grid3", 0, cellsArray); |
michael@0 | 70 | testUnselectTableRow("grid3", 0, cellsArray); |
michael@0 | 71 | |
michael@0 | 72 | SimpleTest.finish(); |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 76 | addA11yLoadEvent(doTest); |
michael@0 | 77 | </script> |
michael@0 | 78 | </head> |
michael@0 | 79 | <body> |
michael@0 | 80 | |
michael@0 | 81 | <a target="_blank" |
michael@0 | 82 | title="implement nsIAccessibleTable selection methods for ARIA grids" |
michael@0 | 83 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">Bug 410052</a> |
michael@0 | 84 | <a target="_blank" |
michael@0 | 85 | title="nsHTMLTableCellAccessible is used in dojo's crazy ARIA grid" |
michael@0 | 86 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=513848">Bug 513848</a> |
michael@0 | 87 | <a target="_blank" |
michael@0 | 88 | title="ARIA columnheader/rowheader shouldn't be selectable by default" |
michael@0 | 89 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=888247">Bug 888247</a> |
michael@0 | 90 | |
michael@0 | 91 | <p id="display"></p> |
michael@0 | 92 | <div id="content" style="display: none"></div> |
michael@0 | 93 | <pre id="test"> |
michael@0 | 94 | </pre> |
michael@0 | 95 | |
michael@0 | 96 | <div role="grid" id="table"> |
michael@0 | 97 | <div role="row"> |
michael@0 | 98 | <span role="gridcell" aria-selected="true">cell1</span> |
michael@0 | 99 | <span role="gridcell" aria-selected="true">cell2</span> |
michael@0 | 100 | <span role="gridcell">cell3</span> |
michael@0 | 101 | <span role="gridcell" aria-selected="true">cell4</span> |
michael@0 | 102 | </div> |
michael@0 | 103 | <div role="row"> |
michael@0 | 104 | <span role="gridcell" aria-selected="true">cell5</span> |
michael@0 | 105 | <span role="gridcell">cell6</span> |
michael@0 | 106 | <span role="gridcell" aria-selected="true">cell7</span> |
michael@0 | 107 | <span role="gridcell" aria-selected="true">cell8</span> |
michael@0 | 108 | </div> |
michael@0 | 109 | <div role="row"> |
michael@0 | 110 | <span role="gridcell" aria-selected="true">cell9</span> |
michael@0 | 111 | <span role="gridcell">cell10</span> |
michael@0 | 112 | <span role="gridcell">cell11</span> |
michael@0 | 113 | <span role="gridcell" aria-selected="true">cell12</span> |
michael@0 | 114 | </div> |
michael@0 | 115 | <div role="row" aria-selected="true"> |
michael@0 | 116 | <span role="gridcell">cell13</span> |
michael@0 | 117 | <span role="gridcell">cell14</span> |
michael@0 | 118 | <span role="gridcell">cell15</span> |
michael@0 | 119 | <span role="gridcell">cell16</span> |
michael@0 | 120 | </div> |
michael@0 | 121 | <div role="row"> |
michael@0 | 122 | <span role="gridcell" aria-selected="true">cell17</span> |
michael@0 | 123 | <span role="gridcell" aria-selected="true">cell18</span> |
michael@0 | 124 | <span role="gridcell" aria-selected="true">cell19</span> |
michael@0 | 125 | <span role="gridcell" aria-selected="true">cell20</span> |
michael@0 | 126 | </div> |
michael@0 | 127 | </div> |
michael@0 | 128 | |
michael@0 | 129 | <div role="grid" id="grid2"> |
michael@0 | 130 | <div role="row"> |
michael@0 | 131 | <table role="presentation"> |
michael@0 | 132 | <tr> |
michael@0 | 133 | <td role="columnheader" aria-selected="false">header1</td> |
michael@0 | 134 | <td role="columnheader" aria-selected="false">header2</td> |
michael@0 | 135 | </tr> |
michael@0 | 136 | </table> |
michael@0 | 137 | </div> |
michael@0 | 138 | <div role="row"> |
michael@0 | 139 | <table role="presentation"> |
michael@0 | 140 | <tr> |
michael@0 | 141 | <td role="gridcell">cell1</td> |
michael@0 | 142 | <td role="gridcell" tabindex="-1">cell2</td> |
michael@0 | 143 | </tr> |
michael@0 | 144 | </table> |
michael@0 | 145 | </div> |
michael@0 | 146 | </div> |
michael@0 | 147 | |
michael@0 | 148 | <div role="grid" id="grid3"> |
michael@0 | 149 | <div role="row"> |
michael@0 | 150 | <div role="columnheader" id="colheader_default">col header1</div> |
michael@0 | 151 | <div role="columnheader" id="colheader_selected" aria-selected="true">col header2</div> |
michael@0 | 152 | <div role="columnheader" id="colheader_notselected" aria-selected="false">col header3</div> |
michael@0 | 153 | </div> |
michael@0 | 154 | <div role="row"> |
michael@0 | 155 | <div role="rowheader" id="rowheader_default">row header1</div> |
michael@0 | 156 | <div role="rowheader" id="rowheader_selected" aria-selected="true">row header2</div> |
michael@0 | 157 | <div role="rowheader" id="rowheader_notselected" aria-selected="false">row header3</div> |
michael@0 | 158 | </div> |
michael@0 | 159 | </div> |
michael@0 | 160 | </body> |
michael@0 | 161 | </html> |