@@ -606,7 +606,36 @@ module('Integration | Component | hds/table/index', function (hooks) {
606
606
607
607
// aria-labels
608
608
609
- test ( 'it renders the expected `aria-label` values for "select all" and rows (based on provided suffix)' , async function ( assert ) {
609
+ test ( 'it renders the expected `aria-label` values for "select all" and rows by default' , async function ( assert ) {
610
+ setSelectableTableData ( this ) ;
611
+ await render ( hbs `
612
+ <Hds::Table
613
+ @isSelectable={{true}}
614
+ @model={{this.model}}
615
+ @columns={{this.columns}}
616
+ id="data-test-selectable-table"
617
+ >
618
+ <:body as |B|>
619
+ <B.Tr @selectionKey={{B.data.id}}>
620
+ <B.Td>{{B.data.artist}}</B.Td>
621
+ <B.Td>{{B.data.album}}</B.Td>
622
+ <B.Td>{{B.data.year}}</B.Td>
623
+ </B.Tr>
624
+ </:body>
625
+ </Hds::Table>
626
+ ` ) ;
627
+
628
+ assert . dom ( selectAllCheckboxSelector ) . hasAria ( 'label' , 'Select all rows' ) ;
629
+ assert . dom ( rowCheckboxesSelector ) . hasAria ( 'label' , 'Select row' ) ;
630
+
631
+ await click ( selectAllCheckboxSelector ) ;
632
+ await click ( rowCheckboxesSelector ) ;
633
+
634
+ assert . dom ( selectAllCheckboxSelector ) . hasAria ( 'label' , 'Select all rows' ) ;
635
+ assert . dom ( rowCheckboxesSelector ) . hasAria ( 'label' , 'Select row' ) ;
636
+ } ) ;
637
+
638
+ test ( 'it renders the expected `aria-label` for rows with `@selectionAriaLabelSuffix`' , async function ( assert ) {
610
639
setSelectableTableData ( this ) ;
611
640
await render ( hbs `
612
641
<Hds::Table
@@ -627,31 +656,11 @@ module('Integration | Component | hds/table/index', function (hooks) {
627
656
</:body>
628
657
</Hds::Table>
629
658
` ) ;
630
- const rowCheckboxes = this . element . querySelectorAll ( rowCheckboxesSelector ) ;
631
- const firstRowCheckbox = rowCheckboxes [ 0 ] ;
632
- const secondRowCheckbox = rowCheckboxes [ 1 ] ;
633
659
634
- assert . dom ( selectAllCheckboxSelector ) . hasAria ( 'label' , 'Select all rows' ) ;
635
660
assert . dom ( rowCheckboxesSelector ) . hasAria ( 'label' , 'Select custom suffix' ) ;
636
- await click ( firstRowCheckbox ) ;
637
- assert . dom ( selectAllCheckboxSelector ) . hasAria ( 'label' , 'Select all rows' ) ;
638
- assert . dom ( firstRowCheckbox ) . hasAria ( 'label' , 'Deselect custom suffix' ) ;
639
- assert . dom ( secondRowCheckbox ) . hasAria ( 'label' , 'Select custom suffix' ) ;
640
- await click ( selectAllCheckboxSelector ) ;
641
- assert . dom ( selectAllCheckboxSelector ) . hasAria ( 'label' , 'Deselect all rows' ) ;
642
- assert . dom ( firstRowCheckbox ) . hasAria ( 'label' , 'Deselect custom suffix' ) ;
643
- assert . dom ( secondRowCheckbox ) . hasAria ( 'label' , 'Deselect custom suffix' ) ;
644
- await click ( secondRowCheckbox ) ;
645
- assert . dom ( selectAllCheckboxSelector ) . hasAria ( 'label' , 'Select all rows' ) ;
646
- assert . dom ( firstRowCheckbox ) . hasAria ( 'label' , 'Deselect custom suffix' ) ;
647
- assert . dom ( secondRowCheckbox ) . hasAria ( 'label' , 'Select custom suffix' ) ;
648
- await click ( secondRowCheckbox ) ;
649
- assert . dom ( selectAllCheckboxSelector ) . hasAria ( 'label' , 'Deselect all rows' ) ;
650
- assert . dom ( firstRowCheckbox ) . hasAria ( 'label' , 'Deselect custom suffix' ) ;
651
- assert . dom ( secondRowCheckbox ) . hasAria ( 'label' , 'Deselect custom suffix' ) ;
652
- await click ( selectAllCheckboxSelector ) ;
653
- assert . dom ( selectAllCheckboxSelector ) . hasAria ( 'label' , 'Select all rows' ) ;
654
- assert . dom ( firstRowCheckbox ) . hasAria ( 'label' , 'Select custom suffix' ) ;
655
- assert . dom ( secondRowCheckbox ) . hasAria ( 'label' , 'Select custom suffix' ) ;
661
+
662
+ await click ( rowCheckboxesSelector ) ;
663
+
664
+ assert . dom ( rowCheckboxesSelector ) . hasAria ( 'label' , 'Select custom suffix' ) ;
656
665
} ) ;
657
666
} ) ;
0 commit comments