@@ -2511,88 +2511,24 @@ describe('IgxQueryBuilder', () => {
25112511 expect ( chipComponents [ 1 ] . nativeElement . getBoundingClientRect ( ) . height ) . toBe ( 0 ) ;
25122512 } ) ;
25132513
2514- xit ( 'Should render drop ghost properly when mouse dragged.' , fakeAsync ( ( ) => {
2514+ it ( 'Should render drop ghost properly when mouse dragged down on the left .' , fakeAsync ( ( ) => {
25152515 const draggedChip = chipComponents [ 1 ] . componentInstance ;
2516- const draggedChipCenter = QueryBuilderFunctions . getElementCenter ( draggedChip . chipArea . nativeElement ) ;
2517- const dragDir = draggedChip . dragDirective ;
2518-
2519- let X = 100 , Y = 75 ;
2520-
2521- //pickup chip
2522- dragDir . onPointerDown ( { pointerId : 1 , pageX : draggedChipCenter . X , pageY : draggedChipCenter . Y } ) ;
2523- fix . detectChanges ( ) ;
2524-
2525- //trigger ghost
2526- QueryBuilderFunctions . dragMove ( dragDir , draggedChipCenter . X + 10 , draggedChipCenter . Y + 10 ) ;
2527- fix . detectChanges ( ) ;
2528-
2529- spyOn ( dragDir . ghostElement , 'dispatchEvent' ) . and . callThrough ( ) ;
2530-
2531- const ghostPositionVisits : boolean [ ] = [ false , false , false , false , false , false , false , false ]
2532-
2533- let i = 0 , pass = 1 , inc = 1 ;
2534-
2535- //Drag ghost up and down four times and check if drop ghost is rendered in the expected positions
2536- while ( pass <= 4 ) {
2537- i += inc ;
2538- Y += inc ;
2539-
2540- QueryBuilderFunctions . dragMove ( dragDir , X , Y ) ;
2541- tick ( ) ;
2542- fix . detectChanges ( ) ;
2543-
2544- const [ dropGhost , prevElement , nextElement ] = QueryBuilderFunctions . getDropGhostAndItsSiblings ( fix ) ;
2545-
2546- if ( i < 40 && ! ghostPositionVisits [ 0 ] ) {
2547- if ( i <= 42 ) tick ( 50 ) ;
2548- if ( ! dropGhost ) ghostPositionVisits [ 0 ] = true ;
2549- }
2550-
2551- if ( i > 35 && i < 122 && ! ghostPositionVisits [ 1 ] ) {
2552- if ( dropGhost && ! prevElement && nextElement == 'OrderName Equals foo' ) ghostPositionVisits [ 1 ] = true ;
2553- }
2554-
2555- if ( i > 120 && i < 165 && ! ghostPositionVisits [ 2 ] ) {
2556- if ( dropGhost && prevElement == 'OrderName Equals foo' && nextElement === 'or OrderName Ends With a OrderDate Today' ) ghostPositionVisits [ 2 ] = true ;
2557- }
2558-
2559- if ( i > 166 && i < 201 && ! ghostPositionVisits [ 3 ] ) {
2560- if ( dropGhost && ! prevElement && nextElement == 'OrderName Ends With a' ) ghostPositionVisits [ 3 ] = true ;
2561- }
2562-
2563- if ( i > 202 && i < 241 && ! ghostPositionVisits [ 4 ] ) {
2564- if ( dropGhost && prevElement == 'OrderName Ends With a' && nextElement === 'OrderDate Today' ) ghostPositionVisits [ 4 ] = true ;
2565- }
2566-
2567- if ( i > 240 && i < 273 && ! ghostPositionVisits [ 5 ] ) {
2568- if ( dropGhost && prevElement == 'OrderDate Today' && ! nextElement ) ghostPositionVisits [ 5 ] = true ;
2569- }
2570-
2571- if ( i > 256 && i < 316 && ! ghostPositionVisits [ 6 ] ) {
2572- if ( pass > 2 || ( dropGhost && prevElement == 'or OrderName Ends With a OrderDate Today' && ! nextElement ) ) ghostPositionVisits [ 6 ] = true ;
2573- }
2574-
2575- if ( i > 320 && ! ghostPositionVisits [ 7 ] ) {
2576- if ( i >= 340 ) tick ( 50 ) ;
2577- if ( ! dropGhost ) ghostPositionVisits [ 7 ] = true ;
2578- }
2579-
2580- //When dragged to the end, check results and reverse direction for next pass
2581- if ( i === 350 || i === 0 ) {
2582- expect ( ghostPositionVisits ) . not . toContain ( false ,
2583- `Ghost was not rendered on position(s) ${ ghostPositionVisits . reduce ( ( arr , e , ix ) => ( ( e == false ) && arr . push ( ix ) , arr ) , [ ] ) . toString ( ) } on pass:${ pass } ` ) ;
2516+ QueryBuilderFunctions . verifyGhostPositionOnMouseDrag ( fix , draggedChip , 100 , 75 , true ) ;
2517+ } ) ) ;
25842518
2585- ghostPositionVisits . fill ( false ) ;
2586- pass ++ ;
2587- inc *= - 1 ;
2588- if ( pass % 2 === 0 ) Y -= ROW_HEIGHT ;
2589- if ( pass % 2 !== 0 ) Y += ROW_HEIGHT ;
2519+ it ( 'Should render drop ghost properly when mouse dragged up on the left.' , fakeAsync ( ( ) => {
2520+ const draggedChip = chipComponents [ 1 ] . componentInstance ;
2521+ QueryBuilderFunctions . verifyGhostPositionOnMouseDrag ( fix , draggedChip , 100 , 75 + 350 , false ) ;
2522+ } ) ) ;
25902523
2591- //go to the left and test the whole chip div as well(blank space to the right)
2592- if ( pass == 3 ) X += 400 ;
2593- }
2594- }
2524+ it ( 'Should render drop ghost properly when mouse dragged down on the right.' , fakeAsync ( ( ) => {
2525+ const draggedChip = chipComponents [ 1 ] . componentInstance ;
2526+ QueryBuilderFunctions . verifyGhostPositionOnMouseDrag ( fix , draggedChip , 500 , 75 , true ) ;
2527+ } ) ) ;
25952528
2529+ it ( 'Should render drop ghost properly when mouse dragged up on the right.' , fakeAsync ( ( ) => {
2530+ const draggedChip = chipComponents [ 1 ] . componentInstance ;
2531+ QueryBuilderFunctions . verifyGhostPositionOnMouseDrag ( fix , draggedChip , 500 , 75 + 350 , false ) ;
25962532 } ) ) ;
25972533
25982534 it ( 'Should position drop ghost below the target condition on dragging down.' , ( ) => {
0 commit comments