import { createElement , getUniqueID , EmitType , remove } from '@syncfusion/ej2-base' ; import { GridModel } from '../../../src/grid/base/grid-model' ; import { Grid } from '../../../src/grid/base/grid' ; /**
 * Util functions for test cases.
 */ export function createGrid ( options , done ) { let id = getUniqueID ( 'Grid' ) ; let dataBound = ( ) => { if ( document . querySelectorAll ( '.e-popup-open' ) . length ) { document . querySelectorAll ( '.e-popup-open' ) [ 0 ] . remove ( ) ; } done ( ) ; } ; options . dataBound = dataBound ; let grid = new Grid ( options ) ; document . body . appendChild ( createElement ( 'div' , { id : id } ) ) ; grid . appendTo ( '#' + id ) ; return grid ; } export function destroy ( grid ) { if ( grid && ! grid . isDestroyed ) { let id = grid . element . id ; grid . destroy ( ) ; remove ( document . getElementById ( id ) ) ; if ( document . getElementById ( id ) ) { document . getElementById ( id ) . remove ( ) ; } } } export function getClickObj ( target , ctrlKey ? , shiftKey ? ) { let preventDefault = ( ) => { } ; return { target : target , shiftKey : shiftKey , ctrlKey : ctrlKey , preventDefault : preventDefault , type : 'click' , clientX : 1 , clientY : 1 } ; } export function getKeyUpObj ( keyCode , target ) { let preventDefault = ( ) => { } ; return { target : target , keyCode : keyCode } ; } export function getKeyActionObj ( action , target ? ) { let preventDefault = ( ) => { } ; return { target : target , action : action , preventDefault : preventDefault } ; }