@@ -717,6 +717,26 @@ describe('igxOverlay', () => {
717
717
expect ( contentDiv ) . toBeDefined ( ) ;
718
718
expect ( contentDiv . classList . contains ( CLASS_OVERLAY_CONTENT_MODAL ) ) . toBeTruthy ( ) ;
719
719
} ) ) ;
720
+
721
+ it ( 'fix for #2486 - filtering dropdown is not correctly positioned' , fakeAsync ( ( ) => {
722
+ const fix = TestBed . createComponent ( WidthTestOverlayComponent ) ;
723
+ fix . debugElement . nativeElement . style . transform = 'translatex(100px)' ;
724
+
725
+ fix . detectChanges ( ) ;
726
+ tick ( ) ;
727
+
728
+ fix . componentInstance . overlaySettings . outlet = fix . componentInstance . elementRef ;
729
+
730
+ const buttonElement : HTMLElement = fix . componentInstance . buttonElement . nativeElement ;
731
+ buttonElement . click ( ) ;
732
+
733
+ fix . detectChanges ( ) ;
734
+ tick ( ) ;
735
+
736
+ const wrapper = document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER ) [ 0 ] ;
737
+ expect ( wrapper . getBoundingClientRect ( ) . left ) . toBe ( 100 ) ;
738
+ expect ( fix . componentInstance . customComponent . nativeElement . getBoundingClientRect ( ) . left ) . toBe ( 400 ) ;
739
+ } ) ) ;
720
740
} ) ;
721
741
722
742
describe ( 'Integration tests: ' , ( ) => {
@@ -2560,20 +2580,22 @@ export class TwoButtonsComponent {
2560
2580
} )
2561
2581
export class WidthTestOverlayComponent {
2562
2582
2563
- constructor ( @Inject ( IgxOverlayService ) public overlay : IgxOverlayService ) { }
2583
+ constructor (
2584
+ @Inject ( IgxOverlayService ) public overlay : IgxOverlayService ,
2585
+ public elementRef : ElementRef
2586
+ ) { }
2564
2587
2565
2588
@ViewChild ( 'button' ) buttonElement : ElementRef ;
2566
2589
@ViewChild ( 'myCustomComponent' ) customComponent : ElementRef ;
2590
+ public overlaySettings : OverlaySettings = { } ;
2567
2591
click ( event ) {
2568
- const overlaySettings : OverlaySettings = {
2569
- positionStrategy : new ConnectedPositioningStrategy ( ) ,
2570
- scrollStrategy : new NoOpScrollStrategy ( ) ,
2571
- closeOnOutsideClick : true ,
2572
- modal : false
2573
- } ;
2592
+ this . overlaySettings . positionStrategy = new ConnectedPositioningStrategy ( ) ;
2593
+ this . overlaySettings . scrollStrategy = new NoOpScrollStrategy ( ) ;
2594
+ this . overlaySettings . closeOnOutsideClick = true ;
2595
+ this . overlaySettings . modal = false ;
2574
2596
2575
- overlaySettings . positionStrategy . settings . target = this . buttonElement . nativeElement ;
2576
- this . overlay . show ( this . customComponent , overlaySettings ) ;
2597
+ this . overlaySettings . positionStrategy . settings . target = this . buttonElement . nativeElement ;
2598
+ this . overlay . show ( this . customComponent , this . overlaySettings ) ;
2577
2599
}
2578
2600
}
2579
2601
0 commit comments