| 37 | } |
| 38 | |
| 39 | function fixture() { |
| 40 | return ` |
| 41 | <ot-table empty-text="Nothing here"> |
| 42 | <form data-table-toolbar role="search"> |
| 43 | <input type="search" data-table-filter> |
| 44 | <output data-table-selected></output> |
| 45 | <output data-table-status></output> |
| 46 | </form> |
| 47 | <div class="table"> |
| 48 | <table> |
| 49 | <thead> |
| 50 | <tr> |
| 51 | <th><input type="checkbox" data-table-select-all></th> |
| 52 | <th data-sort>Name</th> |
| 53 | <th data-sort="number">Tickets</th> |
| 54 | <th data-sort="date">Last seen</th> |
| 55 | </tr> |
| 56 | </thead> |
| 57 | <tbody> |
| 58 | <tr data-filter-text="charlie admin active"> |
| 59 | <td><input type="checkbox" data-table-select-row value="charlie"></td> |
| 60 | <td>Charlie</td> |
| 61 | <td data-sort-value="14">14 tickets</td> |
| 62 | <td><time datetime="2026-05-11">May 11</time></td> |
| 63 | </tr> |
| 64 | <tr data-filter-text="ada editor active"> |
| 65 | <td><input type="checkbox" data-table-select-row value="ada"></td> |
| 66 | <td>Ada</td> |
| 67 | <td data-sort-value="2">2 tickets</td> |
| 68 | <td><time datetime="2026-05-16">May 16</time></td> |
| 69 | </tr> |
| 70 | <tr data-filter-text="bravo viewer pending"> |
| 71 | <td><input type="checkbox" data-table-select-row value="bravo"></td> |
| 72 | <td>Bravo</td> |
| 73 | <td data-sort-value="8">8 tickets</td> |
| 74 | <td><time datetime="2026-04-02">Apr 2</time></td> |
| 75 | </tr> |
| 76 | </tbody> |
| 77 | </table> |
| 78 | </div> |
| 79 | </ot-table> |
| 80 | `; |
| 81 | } |
| 82 | |
| 83 | test('enhances sortable headers with buttons and aria-sort', () => { |
| 84 | const dom = setup(fixture()); |