66 SelectionWithTransactionsComponent ,
77 CellSelectionNoneComponent ,
88 CellSelectionSingleComponent ,
9- IgxGridCellTemplateForRangeSelectionComponent
9+ IgxGridRowEditingWithoutEditableColumnsComponent
1010} from '../../test-utils/grid-samples.spec' ;
1111import { IgxStringFilteringOperand } from '../../data-operations/filtering-condition' ;
1212import { UIInteractions , wait } from '../../test-utils/ui-interactions.spec' ;
@@ -28,7 +28,7 @@ describe('IgxGrid - Cell selection #grid', () => {
2828 SelectionWithTransactionsComponent ,
2929 CellSelectionNoneComponent ,
3030 CellSelectionSingleComponent ,
31- IgxGridCellTemplateForRangeSelectionComponent
31+ IgxGridRowEditingWithoutEditableColumnsComponent
3232 ]
3333 } ) . compileComponents ( ) ;
3434 } ) ) ;
@@ -258,19 +258,31 @@ describe('IgxGrid - Cell selection #grid', () => {
258258 expect ( grid . selectedCells . length ) . toBe ( 1 ) ;
259259 } ) ;
260260
261- it ( 'Should not trigger range selection when CellTemplate is used and the user clicks on element inside it' , ( ) => {
262- fix = TestBed . createComponent ( IgxGridCellTemplateForRangeSelectionComponent ) ;
261+ it ( 'Should not trigger range selection when CellTemplate is used and the user clicks on element inside it' , ( ) => {
262+ fix = TestBed . createComponent ( IgxGridRowEditingWithoutEditableColumnsComponent ) ;
263263 fix . detectChanges ( ) ;
264+
265+ const component = fix . componentInstance ;
264266 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 ( ) ;
266273
267274 const selectionChangeSpy = spyOn < any > ( grid . rangeSelected , 'emit' ) . and . callThrough ( ) ;
268275 const cell = grid . gridAPI . get_cell_by_index ( 1 , 'ProductID' ) ;
269276 const cellElement = cell . nativeElement ;
270277 const span = cellElement . querySelector ( 'span' ) ;
271278
272279 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 ) ;
274286 fix . detectChanges ( ) ;
275287 expect ( selectionChangeSpy ) . not . toHaveBeenCalled ( ) ;
276288 } ) ;
0 commit comments