6
6
SelectionWithTransactionsComponent ,
7
7
CellSelectionNoneComponent ,
8
8
CellSelectionSingleComponent ,
9
- IgxGridCellTemplateForRangeSelectionComponent
9
+ IgxGridRowEditingWithoutEditableColumnsComponent
10
10
} from '../../test-utils/grid-samples.spec' ;
11
11
import { IgxStringFilteringOperand } from '../../data-operations/filtering-condition' ;
12
12
import { UIInteractions , wait } from '../../test-utils/ui-interactions.spec' ;
@@ -28,7 +28,7 @@ describe('IgxGrid - Cell selection #grid', () => {
28
28
SelectionWithTransactionsComponent ,
29
29
CellSelectionNoneComponent ,
30
30
CellSelectionSingleComponent ,
31
- IgxGridCellTemplateForRangeSelectionComponent
31
+ IgxGridRowEditingWithoutEditableColumnsComponent
32
32
]
33
33
} ) . compileComponents ( ) ;
34
34
} ) ) ;
@@ -259,18 +259,30 @@ describe('IgxGrid - Cell selection #grid', () => {
259
259
} ) ;
260
260
261
261
it ( 'Should not trigger range selection when CellTemplate is used and the user clicks on element inside it' , ( ) => {
262
- fix = TestBed . createComponent ( IgxGridCellTemplateForRangeSelectionComponent ) ;
262
+ fix = TestBed . createComponent ( IgxGridRowEditingWithoutEditableColumnsComponent ) ;
263
263
fix . detectChanges ( ) ;
264
+
265
+ const component = fix . componentInstance ;
264
266
grid = fix . componentInstance . grid ;
265
- detect = ( ) => grid . cdr . detectChanges ( ) ;
267
+
268
+ expect ( component . customCell ) . toBeDefined ( ) ;
269
+
270
+ const column = grid . getColumnByName ( 'ProductID' ) ;
271
+ column . bodyTemplate = component . customCell ;
272
+ fix . detectChanges ( ) ;
266
273
267
274
const selectionChangeSpy = spyOn < any > ( grid . rangeSelected , 'emit' ) . and . callThrough ( ) ;
268
275
const cell = grid . gridAPI . get_cell_by_index ( 1 , 'ProductID' ) ;
269
276
const cellElement = cell . nativeElement ;
270
277
const span = cellElement . querySelector ( 'span' ) ;
271
278
272
279
expect ( span ) . not . toBeNull ( ) ;
273
- span . click ( ) ;
280
+
281
+
282
+ const pointerDown = new PointerEvent ( 'pointerdown' , { bubbles : true } ) ;
283
+ const pointerUp = new PointerEvent ( 'pointerup' , { bubbles : true } ) ;
284
+ span . dispatchEvent ( pointerDown ) ;
285
+ span . dispatchEvent ( pointerUp ) ;
274
286
fix . detectChanges ( ) ;
275
287
expect ( selectionChangeSpy ) . not . toHaveBeenCalled ( ) ;
276
288
} ) ;
0 commit comments