File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
packages/react-bootstrap-table2/test Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -393,12 +393,26 @@ describe('HeaderCell', () => {
393
393
it ( 'should have onClick event on header cell' , ( ) => {
394
394
expect ( wrapper . find ( 'th' ) . prop ( 'onClick' ) ) . toBeDefined ( ) ;
395
395
} ) ;
396
+
397
+ it ( 'should have onKeyUp event on header cell' , ( ) => {
398
+ expect ( wrapper . find ( 'th' ) . prop ( 'onKeyUp' ) ) . toBeDefined ( ) ;
399
+ } ) ;
396
400
397
401
it ( 'should trigger onSort callback when click on header cell' , ( ) => {
398
402
wrapper . find ( 'th' ) . simulate ( 'click' ) ;
399
403
expect ( onSortCallBack . callCount ) . toBe ( 1 ) ;
400
404
} ) ;
401
405
406
+ it ( 'should trigger onSort callback when keyup Enter on header cell' , ( ) => {
407
+ wrapper . find ( 'th' ) . simulate ( 'keyup' , { key : 'Enter' } ) ;
408
+ expect ( onSortCallBack . callCount ) . toBe ( 1 ) ;
409
+ } ) ;
410
+
411
+ it ( 'should not trigger onSort callback when keyup key is not Enter on header cell' , ( ) => {
412
+ wrapper . find ( 'th' ) . simulate ( 'keyup' , { key : 'test-key' } ) ;
413
+ expect ( onSortCallBack . callCount ) . toBe ( 0 ) ;
414
+ } ) ;
415
+
402
416
describe ( 'and sorting prop is false' , ( ) => {
403
417
it ( 'header should render SortSymbol as default' , ( ) => {
404
418
expect ( wrapper . find ( SortSymbol ) . length ) . toBe ( 1 ) ;
You can’t perform that action at this time.
0 commit comments