@@ -53,7 +53,8 @@ const columns = [
53
53
} ,
54
54
{
55
55
Header : ( ) => < span > Friend Age</ span > , // Custom header components!
56
- accessor : 'friend.age'
56
+ accessor : 'friend.age' ,
57
+ headerLabel : 'Custom Label'
57
58
}
58
59
] ;
59
60
const data = [
@@ -1258,8 +1259,9 @@ describe('AnalyticalTable', () => {
1258
1259
} ) ;
1259
1260
} ) ;
1260
1261
it ( 'columns drag & drop' , ( ) => {
1261
- columns . pop ( ) ;
1262
- const updatedCols = [ ...columns , { accessor : 'friend.age' , Header : 'Friend Age' , disableDragAndDrop : true } ] ;
1262
+ const localCols = [ ...columns ] ;
1263
+ localCols . pop ( ) ;
1264
+ const updatedCols = [ ...localCols , { accessor : 'friend.age' , Header : 'Friend Age' , disableDragAndDrop : true } ] ;
1263
1265
const reorder = cy . spy ( ) . as ( 'reorder' ) ;
1264
1266
[ 'ltr' , 'rtl' ] . forEach ( ( dir ) => {
1265
1267
cy . mount ( < AnalyticalTable dir = { dir } data = { data } columns = { updatedCols } onColumnsReorder = { reorder } /> ) ;
@@ -1742,7 +1744,7 @@ describe('AnalyticalTable', () => {
1742
1744
cy . findByText ( 'Selected: {"0":true,"1":true,"2":true,"3":true}' ) . should ( 'be.visible' ) ;
1743
1745
} ) ;
1744
1746
1745
- it ( 'a11y: grouped, filtered, sorted' , ( ) => {
1747
+ it ( 'a11y: grouped, filtered, sorted, headerLabel ' , ( ) => {
1746
1748
cy . mount ( < AnalyticalTable columns = { columns } data = { data } groupable filterable sortable /> ) ;
1747
1749
cy . findByText ( 'Name' ) . click ( ) ;
1748
1750
cy . findByText ( 'Sort Ascending' ) . shadow ( ) . findByRole ( 'listitem' ) . click ( { force : true } ) ;
@@ -1767,24 +1769,32 @@ describe('AnalyticalTable', () => {
1767
1769
cy . get ( '[data-visible-row-index="1"][data-visible-column-index="0"]' ) . should (
1768
1770
'have.attr' ,
1769
1771
'aria-label' ,
1770
- 'Grouped, To expand the row, press the spacebar'
1772
+ 'Name Grouped, To expand the row, press the spacebar'
1771
1773
) ;
1772
1774
cy . get ( '[name="navigation-right-arrow"]' ) . click ( ) ;
1773
1775
cy . get ( '[data-visible-row-index="1"][data-visible-column-index="0"]' ) . should (
1774
1776
'have.attr' ,
1775
1777
'aria-label' ,
1776
- 'Grouped, To collapse the row, press the spacebar'
1778
+ 'Name Grouped, To collapse the row, press the spacebar'
1777
1779
) ;
1778
1780
cy . findByText ( 'Name' ) . click ( ) ;
1779
1781
cy . findByText ( 'Ungroup' ) . shadow ( ) . findByRole ( 'listitem' ) . click ( { force : true } ) ;
1780
- cy . get ( '[data-visible-row-index="1"][data-visible-column-index="0"]' ) . should ( 'not. have.attr' , 'aria-label' ) ;
1782
+ cy . get ( '[data-visible-row-index="1"][data-visible-column-index="0"]' ) . should ( 'have.attr' , 'aria-label' , 'Name ') ;
1781
1783
cy . get ( '[data-column-id="name"]' )
1782
1784
. should ( 'have.attr' , 'aria-sort' , 'descending' )
1783
1785
. and ( 'have.attr' , 'aria-label' , 'Filtered' ) ;
1784
1786
1785
1787
cy . findByText ( 'Name' ) . click ( ) ;
1786
1788
cy . findByText ( 'Sort Ascending' ) . shadow ( ) . get ( '[ui5-input]' ) . typeIntoUi5Input ( '{selectall}{backspace}{enter}' ) ;
1787
- cy . get ( '[data-column-id="name"]' ) . should ( 'have.attr' , 'aria-sort' , 'descending' ) . and ( 'not.have.attr' , 'aria-label' ) ;
1789
+ cy . get ( '[data-column-id="name"]' ) . should ( 'have.attr' , 'aria-sort' , 'descending' ) . and ( 'have.attr' , 'aria-label' , '' ) ;
1790
+
1791
+ cy . get ( '[data-column-id="friend.age"]' ) . should ( 'have.attr' , 'aria-label' , 'Custom Label ' ) ;
1792
+ cy . realPress ( 'ArrowDown' ) ;
1793
+ cy . get ( '[data-visible-row-index="1"][data-visible-column-index="3"]' ) . should (
1794
+ 'have.attr' ,
1795
+ 'aria-label' ,
1796
+ 'Custom Label '
1797
+ ) ;
1788
1798
} ) ;
1789
1799
1790
1800
it ( "Expandable: don't scroll when expanded/collapsed" , ( ) => {
@@ -2234,7 +2244,7 @@ describe('AnalyticalTable', () => {
2234
2244
cy . focused ( ) . should ( 'have.attr' , 'data-row-index' , '0' ) . should ( 'have.attr' , 'data-column-index' , '0' ) ;
2235
2245
2236
2246
cy . realPress ( 'End' ) ;
2237
- cy . focused ( ) . should ( 'have.attr' , 'data-row-index' , '0' ) . should ( 'have.attr' , 'data-column-index' , '2 ' ) ;
2247
+ cy . focused ( ) . should ( 'have.attr' , 'data-row-index' , '0' ) . should ( 'have.attr' , 'data-column-index' , '3 ' ) ;
2238
2248
cy . realPress ( 'Home' ) ;
2239
2249
cy . focused ( ) . should ( 'have.attr' , 'data-row-index' , '0' ) . should ( 'have.attr' , 'data-column-index' , '0' ) ;
2240
2250
0 commit comments