@@ -546,7 +546,7 @@ describe('igxOverlay', () => {
546546 expect ( overlayContentTransform ) . toEqual ( secondTransform ) ;
547547 } ) ) ;
548548
549- it ( 'fix for # 1690 - click on second filter does not close first one.' , fakeAsync ( ( ) => {
549+ it ( 'fixes 1690 - click on second filter does not close first one.' , fakeAsync ( ( ) => {
550550 const fixture = TestBed . createComponent ( TwoButtonsComponent ) ;
551551 const button1 = fixture . nativeElement . getElementsByClassName ( 'buttonOne' ) [ 0 ] ;
552552 const button2 = fixture . nativeElement . getElementsByClassName ( 'buttonTwo' ) [ 0 ] ;
@@ -563,7 +563,7 @@ describe('igxOverlay', () => {
563563 expect ( overlayDiv . children . length ) . toBe ( 1 ) ;
564564 } ) ) ;
565565
566- it ( 'fix for # 1692 - scroll strategy closes overlay when shown component is scrolled.' , fakeAsync ( ( ) => {
566+ it ( 'fixes 1692 - scroll strategy closes overlay when shown component is scrolled.' , fakeAsync ( ( ) => {
567567 const fixture = TestBed . createComponent ( SimpleDynamicWithDirectiveComponent ) ;
568568 const overlaySettings : OverlaySettings = { scrollStrategy : new CloseScrollStrategy ( ) } ;
569569 fixture . componentInstance . show ( overlaySettings ) ;
@@ -590,7 +590,7 @@ describe('igxOverlay', () => {
590590 } ) ) ;
591591
592592 // TODO: refactor utilities to include all exported methods in a class
593- it ( 'fix for # 1799 - content div should reposition on window resize.' , fakeAsync ( ( ) => {
593+ it ( 'fixes 1799 - content div should reposition on window resize.' , fakeAsync ( ( ) => {
594594 const rect : ClientRect = {
595595 bottom : 50 ,
596596 height : 0 ,
@@ -632,7 +632,7 @@ describe('igxOverlay', () => {
632632 overlayInstance . hide ( id ) ;
633633 } ) ) ;
634634
635- it ( 'fix for # 2475 - An error is thrown for IgxOverlay when showing a component' +
635+ it ( 'fixes 2475 - An error is thrown for IgxOverlay when showing a component' +
636636 'instance that is not attached to the DOM' , fakeAsync ( ( ) => {
637637 const fix = TestBed . createComponent ( SimpleRefComponent ) ;
638638 fix . detectChanges ( ) ;
@@ -653,7 +653,7 @@ describe('igxOverlay', () => {
653653 expect ( contentDiv . classList . contains ( CLASS_OVERLAY_CONTENT_MODAL ) ) . toBeTruthy ( ) ;
654654 } ) ) ;
655655
656- it ( 'fix for # 2486 - filtering dropdown is not correctly positioned' , fakeAsync ( ( ) => {
656+ it ( 'fixes 2486 - filtering dropdown is not correctly positioned' , fakeAsync ( ( ) => {
657657 const fix = TestBed . createComponent ( WidthTestOverlayComponent ) ;
658658 fix . debugElement . nativeElement . style . transform = 'translatex(100px)' ;
659659
@@ -673,7 +673,7 @@ describe('igxOverlay', () => {
673673 expect ( fix . componentInstance . customComponent . nativeElement . getBoundingClientRect ( ) . left ) . toBe ( 400 ) ;
674674 } ) ) ;
675675
676- it ( 'fix for # 2798 - Allow canceling of open and close of IgxDropDown through onOpening and onClosing events' , fakeAsync ( ( ) => {
676+ it ( 'fixes 2798 - Allow canceling of open and close of IgxDropDown through onOpening and onClosing events' , fakeAsync ( ( ) => {
677677 const fix = TestBed . createComponent ( SimpleRefComponent ) ;
678678 fix . detectChanges ( ) ;
679679 const overlayInstance = fix . componentInstance . overlay ;
@@ -710,7 +710,7 @@ describe('igxOverlay', () => {
710710 expect ( overlayInstance . onOpened . emit ) . toHaveBeenCalledTimes ( 1 ) ;
711711 } ) ) ;
712712
713- it ( 'fix for # 3673 - Should not close dropdown in dropdown' , fakeAsync ( ( ) => {
713+ it ( 'fixes 3673 - Should not close dropdown in dropdown' , fakeAsync ( ( ) => {
714714 const fix = TestBed . createComponent ( EmptyPageComponent ) ;
715715 const button = fix . componentInstance . buttonElement ;
716716 const overlay = fix . componentInstance . overlay ;
@@ -746,7 +746,7 @@ describe('igxOverlay', () => {
746746 expect ( overlayDiv . children [ 0 ] . localName ) . toEqual ( 'div' ) ;
747747 } ) ) ;
748748
749- it ( 'fix for # 3743 - Reposition correctly resized element.' , ( ) => {
749+ it ( 'fixes 3743 - Reposition correctly resized element.' , ( ) => {
750750 const fixture = TestBed . createComponent ( TopLeftOffsetComponent ) ;
751751 fixture . detectChanges ( ) ;
752752
@@ -798,7 +798,7 @@ describe('igxOverlay', () => {
798798 document . body . removeChild ( wrapperElement ) ;
799799 } ) ;
800800
801- it ( 'Fix for # 3988 - Should use ngModuleRef to create component' , inject ( [ ApplicationRef ] , ( appRef : ApplicationRef ) => {
801+ it ( 'Fixes 3988 - Should use ngModuleRef to create component' , inject ( [ ApplicationRef ] , ( appRef : ApplicationRef ) => {
802802 const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
803803 const overlay = fixture . componentInstance . overlay ;
804804 fixture . detectChanges ( ) ;
@@ -822,6 +822,46 @@ describe('igxOverlay', () => {
822822 expect ( appRef . attachView ) . toHaveBeenCalledWith ( 'test' ) ;
823823 expect ( overlay . getOverlayById ( id ) . componentRef as any ) . toBe ( mockComponent ) ;
824824 } ) ) ;
825+
826+ it ( 'fixes #6474 - should calculate correctly position' , ( ) => {
827+ const elastic : ElasticPositionStrategy = new ElasticPositionStrategy ( ) ;
828+ const targetRect : ClientRect = {
829+ top : 100 ,
830+ bottom : 200 ,
831+ height : 100 ,
832+ left : 100 ,
833+ right : 200 ,
834+ width : 100
835+ } ;
836+ const elementRect : ClientRect = {
837+ top : 0 ,
838+ bottom : 300 ,
839+ height : 300 ,
840+ left : 0 ,
841+ right : 300 ,
842+ width : 300
843+ } ;
844+ const viewPortRect : ClientRect = {
845+ top : 1000 ,
846+ bottom : 1300 ,
847+ height : 300 ,
848+ left : 1000 ,
849+ right : 1300 ,
850+ width : 300
851+ } ;
852+ spyOn < any > ( elastic , 'setStyle' ) . and . returnValue ( { } ) ;
853+ spyOn ( Util , 'getViewportRect' ) . and . returnValue ( viewPortRect ) ;
854+ spyOn ( Util , 'getTargetRect' ) . and . returnValue ( targetRect ) ;
855+
856+ const element = jasmine . createSpyObj ( 'HTMLElement' , [ 'getBoundingClientRect' ] ) ;
857+ spyOn ( element , 'getBoundingClientRect' ) . and . returnValue ( elementRect ) ;
858+ element . classList = { add : ( ) => { } } ;
859+ element . style = { width : '' , height : '' } ;
860+ elastic . position ( element , null , null , true ) ;
861+
862+ expect ( element . style . width ) . toBe ( '200px' ) ;
863+ expect ( element . style . height ) . toBe ( '100px' ) ;
864+ } ) ;
825865 } ) ;
826866
827867 describe ( 'Unit Tests - Scroll Strategies: ' , ( ) => {
@@ -2614,7 +2654,7 @@ describe('igxOverlay', () => {
26142654 tick ( ) ;
26152655 } ) ) ;
26162656
2617- // Test fix for # 1883 #1820
2657+ // Test fixes 1883 #1820
26182658 it ( 'It should close the component when esc key is pressed and there were other keys pressed prior to esc.' , fakeAsync ( ( ) => {
26192659 const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
26202660 const overlay = fixture . componentInstance . overlay ;
0 commit comments