@@ -617,6 +617,8 @@ describe('AnalyticalTable', () => {
617
617
cy . findByTestId ( 'payloadRowsById' ) . should ( 'have.text' , '{"1":true,"2":true,"3":false}' ) ;
618
618
cy . findByTestId ( 'payloadAllRowsSelected' ) . should ( 'have.text' , 'false' ) ;
619
619
620
+ //select all
621
+ //click
620
622
cy . get ( '[data-row-index="0"][data-column-index="0"]' ) . click ( ) ;
621
623
cy . get ( '@onRowSelectSpy' ) . should ( 'have.callCount' , 6 ) ;
622
624
cy . findByTestId ( 'payload' ) . should (
@@ -629,6 +631,33 @@ describe('AnalyticalTable', () => {
629
631
) ;
630
632
cy . findByTestId ( 'payloadAllRowsSelected' ) . should ( 'have.text' , 'true' ) ;
631
633
634
+ // enter (keydown)
635
+ cy . get ( '[data-row-index="0"][data-column-index="0"]' ) . realPress ( 'Enter' ) ;
636
+ cy . get ( '@onRowSelectSpy' ) . should ( 'have.callCount' , 7 ) ;
637
+ cy . findByTestId ( 'payload' ) . should ( 'have.text' , '[]' ) ;
638
+ cy . findByTestId ( 'payloadRowsById' ) . should ( 'have.text' , '{}' ) ;
639
+ cy . findByTestId ( 'payloadAllRowsSelected' ) . should ( 'have.text' , 'false' ) ;
640
+
641
+ // Space (keyup) + ArrowDown => 1st row selected
642
+ cy . get ( '[data-row-index="0"][data-column-index="0"]' ) . realPress ( [ 'Space' , 'ArrowDown' ] ) ;
643
+ cy . get ( '@onRowSelectSpy' ) . should ( 'have.callCount' , 8 ) ;
644
+ cy . findByTestId ( 'payload' ) . should ( 'have.text' , '["0"]' ) ;
645
+ cy . findByTestId ( 'payloadRowsById' ) . should ( 'have.text' , '{"0":true}' ) ;
646
+ cy . findByTestId ( 'payloadAllRowsSelected' ) . should ( 'have.text' , 'false' ) ;
647
+
648
+ // Space (keyup) + ArrowUp => all rows selected
649
+ cy . get ( '[data-row-index="0"][data-column-index="0"]' ) . realPress ( [ 'Space' , 'ArrowUp' ] ) ;
650
+ cy . get ( '@onRowSelectSpy' ) . should ( 'have.callCount' , 9 ) ;
651
+ cy . findByTestId ( 'payload' ) . should (
652
+ 'have.text' ,
653
+ '["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"]'
654
+ ) ;
655
+ cy . findByTestId ( 'payloadRowsById' ) . should (
656
+ 'have.text' ,
657
+ '{"0":true,"1":true,"2":true,"3":true,"4":true,"5":true,"6":true,"7":true,"8":true,"9":true,"10":true,"11":true,"12":true,"13":true,"14":true,"15":true,"16":true,"17":true,"18":true,"19":true,"20":true}'
658
+ ) ;
659
+ cy . findByTestId ( 'payloadAllRowsSelected' ) . should ( 'have.text' , 'true' ) ;
660
+
632
661
cy . get ( '[data-row-index="0"][data-column-index="0"]' ) . click ( ) ;
633
662
634
663
cy . findByText ( 'Name-0' ) . click ( ) ;
@@ -641,7 +670,7 @@ describe('AnalyticalTable', () => {
641
670
cy . findByTestId ( 'payloadAllRowsSelected' ) . should ( 'have.text' , 'false' ) ;
642
671
643
672
cy . get ( '[data-row-index="0"][data-column-index="0"]' ) . click ( ) ;
644
- cy . get ( '@onRowSelectSpy' ) . should ( 'have.callCount' , 11 ) ;
673
+ cy . get ( '@onRowSelectSpy' ) . should ( 'have.callCount' , 14 ) ;
645
674
cy . findByTestId ( 'payload' ) . should ( 'have.text' , '["0","1","5","7","17","20"]' ) ;
646
675
cy . findByTestId ( 'payloadRowsById' ) . should ( 'have.text' , '{"0":true,"1":true,"5":true,"7":true,"17":true,"20":true}' ) ;
647
676
cy . findByTestId ( 'payloadAllRowsSelected' ) . should ( 'have.text' , 'false' ) ;
@@ -696,7 +725,7 @@ describe('AnalyticalTable', () => {
696
725
'{"0":true,"1":true,"2":true,"3":true,"4":true,"5":true,"6":true,"7":true,"8":true,"9":true,"10":true,"11":true,"12":true,"13":true,"14":true,"15":true,"16":true,"17":true,"18":true,"19":true,"20":true}'
697
726
) ;
698
727
cy . findByTestId ( 'payloadAllRowsSelected' ) . should ( 'have.text' , 'true' ) ;
699
- cy . get ( '@onRowSelectSpy' ) . should ( 'have.callCount' , 16 ) ;
728
+ cy . get ( '@onRowSelectSpy' ) . should ( 'have.callCount' , 19 ) ;
700
729
} ) ;
701
730
702
731
it ( 'row & header height' , ( ) => {
0 commit comments