@@ -689,6 +689,25 @@ describe('multi selection column', () => {
689
689
expect ( grid . selectedItems ) . to . eql ( grid . items . slice ( 1 , 4 ) ) ;
690
690
} ) ;
691
691
692
+ it ( 'should not attempt to select item on mouse drag if it is already selected' , ( ) => {
693
+ const selectItemSpy = sinon . spy ( selectionColumn , '_selectItem' ) ;
694
+
695
+ const row0cell = getBodyCellContent ( grid , 0 , 0 ) ;
696
+ const row1cell = getBodyCellContent ( grid , 1 , 0 ) ;
697
+
698
+ grid . selectedItems = [ rows [ 1 ] . _item ] ;
699
+
700
+ fireTrackEvent ( row0cell , row0cell , 'start' ) ;
701
+ clock . tick ( 10 ) ;
702
+ fireTrackEvent ( row1cell , row0cell , 'track' ) ;
703
+ clock . tick ( 10 ) ;
704
+ fireTrackEvent ( row1cell , row0cell , 'end' ) ;
705
+ clock . tick ( 10 ) ;
706
+
707
+ expect ( selectItemSpy ) . to . be . calledOnce ;
708
+ expect ( selectItemSpy . args [ 0 ] [ 0 ] ) . to . not . equal ( '1' ) ;
709
+ } ) ;
710
+
692
711
it ( 'should not select any items on mouse drag when dragSelect is disabled' , ( ) => {
693
712
selectionColumn . dragSelect = false ;
694
713
@@ -775,6 +794,25 @@ describe('multi selection column', () => {
775
794
expect ( grid . selectedItems ) . to . empty ;
776
795
} ) ;
777
796
797
+ it ( 'should not attempt to deselect item on mouse drag if it is already deselected' , ( ) => {
798
+ const deselectItemSpy = sinon . spy ( selectionColumn , '_deselectItem' ) ;
799
+
800
+ const row0cell = getBodyCellContent ( grid , 0 , 0 ) ;
801
+ const row1cell = getBodyCellContent ( grid , 1 , 0 ) ;
802
+
803
+ grid . selectedItems = [ rows [ 0 ] . _item ] ;
804
+
805
+ fireTrackEvent ( row0cell , row0cell , 'start' ) ;
806
+ clock . tick ( 10 ) ;
807
+ fireTrackEvent ( row1cell , row0cell , 'track' ) ;
808
+ clock . tick ( 10 ) ;
809
+ fireTrackEvent ( row1cell , row0cell , 'end' ) ;
810
+ clock . tick ( 10 ) ;
811
+
812
+ expect ( deselectItemSpy ) . to . be . calledOnce ;
813
+ expect ( deselectItemSpy . args [ 0 ] [ 0 ] ) . to . not . equal ( '1' ) ;
814
+ } ) ;
815
+
778
816
it ( 'should prevent text selection on mouse dragging' , ( ) => {
779
817
const spy = sinon . spy ( ) ;
780
818
const sourceCell = getBodyCellContent ( grid , 0 , 0 ) ;
0 commit comments