1b28aa7b2c9ca9b9f90adabd5af31c5dc88d811c
[WebKit-https.git] / LayoutTests / platform / mac / accessibility / aria-treegrid.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../resources/js-test-pre.js"></script>
5 </head>
6 <body id="body">
7
8 <table tabindex=0 id="grid-1" role="treegrid" aria-labelledby="grid-1-header" border="1" aria-activedescendant="row1">
9 <thead>
10     <tr ca="tr" role="row" aria-level="1" id="row1">
11         <th id="grid-1-isbn_id">Book Name / ISBN</th><th id="grid-1-author_id">Author</th><th id="grid-1-price_id" class="numeric" >Price ($)</th>
12     </tr>
13 </thead>
14 <tbody>
15     <tr ca="to" role="row" aria-level="1" aria-expanded="true">
16          <td headers="grid-1-title_id" id="table_entry" role="gridcell" colspan="3"  tabindex="0">
17          <span class="expand">+</span> A Question of Love</td>                  
18      </tr>
19      <tr ca="ti" role="row"  aria-level="2" aria-expanded="true">
20          <td headers="grid-1-isbn_id" role="gridcell">978-3-453-40540-0</td>
21          <td headers="grid-1-author_id" role="gridcell">Nora Roberts</td>
22          <td headers="grid-1-price_id" class="numeric" role="gridcell" ca="te"><div>9.99</div></td>
23      </tr>
24 </tbody>
25 </table>
26
27 <p id="description"></p>
28 <div id="console"></div>
29
30 <script>
31
32     description("This tests that the treegrid ARIA role does what it should (be exposed as a AXTable and support AXSelectedRows)");
33
34     if (window.accessibilityController) {
35
36           document.getElementById("grid-1").focus();
37           var treegrid = accessibilityController.focusedElement;
38           var selectedRow = treegrid.childAtIndex(0);
39           shouldBe("treegrid.isAttributeSupported('AXSelectedRows')", "true");
40           shouldBe("treegrid.selectedRowAtIndex(0).isEqual(selectedRow)", "true");
41           shouldBe("selectedRow.isExpanded", "false");
42           shouldBe("selectedRow.hierarchicalLevel", "0");
43
44           var secondRow = treegrid.childAtIndex(1);
45           shouldBe("secondRow.isExpanded", "true");
46           shouldBe("secondRow.hierarchicalLevel", "0");
47
48           var thirdRow = treegrid.childAtIndex(2);
49           shouldBe("thirdRow.isExpanded", "true");
50           shouldBe("thirdRow.hierarchicalLevel", "1");
51
52           // Make sure that the row disclosure works correctly.
53           shouldBe("thirdRow.disclosedByRow().isEqual(secondRow)", "true");
54           shouldBe("secondRow.disclosedRowAtIndex(0).isEqual(thirdRow)", "true");
55     }
56
57 </script>
58
59 <script src="../../../resources/js-test-post.js"></script>
60 </body>
61 </html>