@@ -1123,6 +1123,30 @@ describe('Reactable', function() {
11231123 // Make sure the headers have the right classes
11241124 expect ( $ ( nameHeader ) ) . to . have . class ( 'reactable-header-sort-desc' ) ;
11251125 } ) ;
1126+
1127+ it ( 'sorts by last name in ascending order by enter keydown' , function ( ) {
1128+ var nameHeader = $ ( '#table thead tr.reactable-column-header th' ) [ 0 ] ;
1129+ ReactTestUtils . Simulate . keyDown ( nameHeader , { keyCode : 13 } ) ;
1130+
1131+ ReactableTestUtils . expectRowText ( 0 , [ 'Lee Salminen' , '23' , 'Programmer' ] ) ;
1132+ ReactableTestUtils . expectRowText ( 1 , [ 'Griffin Smith' , '18' , 'Engineer' ] ) ;
1133+ ReactableTestUtils . expectRowText ( 2 , [ 'Ian Zhang' , '28' , 'Developer' ] ) ;
1134+
1135+ // Make sure the headers have the right classes
1136+ expect ( $ ( nameHeader ) ) . to . have . class ( 'reactable-header-sort-asc' ) ;
1137+ } ) ;
1138+
1139+ it ( 'does not sort on non-enter keydown' , function ( ) {
1140+ var nameHeader = $ ( '#table thead tr.reactable-column-header th' ) [ 0 ] ;
1141+ ReactTestUtils . Simulate . keyDown ( nameHeader , { keyCode : 10 } ) ;
1142+
1143+ ReactableTestUtils . expectRowText ( 0 , [ 'Lee Salminen' , '23' , 'Programmer' ] ) ;
1144+ ReactableTestUtils . expectRowText ( 1 , [ 'Griffin Smith' , '18' , 'Engineer' ] ) ;
1145+ ReactableTestUtils . expectRowText ( 2 , [ 'Ian Zhang' , '28' , 'Developer' ] ) ;
1146+
1147+ // Make sure the headers have the right classes
1148+ expect ( $ ( nameHeader ) ) . to . have . class ( 'reactable-header-sort-asc' ) ;
1149+ } ) ;
11261150 } ) ;
11271151
11281152 describe ( 'passing `true` to sortable' , function ( ) {
@@ -1658,7 +1682,7 @@ describe('Reactable', function() {
16581682 ReactableTestUtils . expectRowText ( 2 , [ 'Third' ] ) ;
16591683 } ) ;
16601684 } ) ;
1661-
1685+
16621686 describe ( 'sorts and calls onSort callback via props' , function ( ) {
16631687 var sortColumn = null ;
16641688
@@ -1678,7 +1702,7 @@ describe('Reactable', function() {
16781702 // sort based on classname
16791703 return a . props . className . localeCompare ( b . props . className ) ;
16801704 }
1681- } ] }
1705+ } ] }
16821706 onSort = { callback } /> ,
16831707 ReactableTestUtils . testNode ( )
16841708 ) ;
0 commit comments