@@ -549,7 +549,7 @@ describe('igxOverlay', () => {
549549 expect ( overlayContentTransform ) . toEqual ( secondTransform ) ;
550550 } ) ) ;
551551
552- it ( 'fix for #1690 - click on second filter does not close first one.' , fakeAsync ( ( ) => {
552+ it ( '#1690 - click on second filter does not close first one.' , fakeAsync ( ( ) => {
553553 const fixture = TestBed . createComponent ( TwoButtonsComponent ) ;
554554 const button1 = fixture . nativeElement . getElementsByClassName ( 'buttonOne' ) [ 0 ] ;
555555 const button2 = fixture . nativeElement . getElementsByClassName ( 'buttonTwo' ) [ 0 ] ;
@@ -566,7 +566,7 @@ describe('igxOverlay', () => {
566566 expect ( overlayDiv . children . length ) . toBe ( 1 ) ;
567567 } ) ) ;
568568
569- it ( 'fix for #1692 - scroll strategy closes overlay when shown component is scrolled.' , fakeAsync ( ( ) => {
569+ it ( '#1692 - scroll strategy closes overlay when shown component is scrolled.' , fakeAsync ( ( ) => {
570570 const fixture = TestBed . createComponent ( SimpleDynamicWithDirectiveComponent ) ;
571571 const overlaySettings : OverlaySettings = { scrollStrategy : new CloseScrollStrategy ( ) } ;
572572 fixture . componentInstance . show ( overlaySettings ) ;
@@ -593,7 +593,7 @@ describe('igxOverlay', () => {
593593 } ) ) ;
594594
595595 // TODO: refactor utilities to include all exported methods in a class
596- it ( 'fix for #1799 - content div should reposition on window resize.' , fakeAsync ( ( ) => {
596+ it ( '#1799 - content div should reposition on window resize.' , fakeAsync ( ( ) => {
597597 const rect : ClientRect = {
598598 bottom : 50 ,
599599 height : 0 ,
@@ -635,7 +635,7 @@ describe('igxOverlay', () => {
635635 overlayInstance . hide ( id ) ;
636636 } ) ) ;
637637
638- it ( 'fix for #2475 - An error is thrown for IgxOverlay when showing a component' +
638+ it ( '#2475 - An error is thrown for IgxOverlay when showing a component' +
639639 'instance that is not attached to the DOM' , fakeAsync ( ( ) => {
640640 const fix = TestBed . createComponent ( SimpleRefComponent ) ;
641641 fix . detectChanges ( ) ;
@@ -656,7 +656,7 @@ describe('igxOverlay', () => {
656656 expect ( contentDiv . classList . contains ( CLASS_OVERLAY_CONTENT_MODAL ) ) . toBeTruthy ( ) ;
657657 } ) ) ;
658658
659- it ( 'fix for #2486 - filtering dropdown is not correctly positioned' , fakeAsync ( ( ) => {
659+ it ( '#2486 - filtering dropdown is not correctly positioned' , fakeAsync ( ( ) => {
660660 const fix = TestBed . createComponent ( WidthTestOverlayComponent ) ;
661661 fix . debugElement . nativeElement . style . transform = 'translatex(100px)' ;
662662
@@ -676,7 +676,7 @@ describe('igxOverlay', () => {
676676 expect ( fix . componentInstance . customComponent . nativeElement . getBoundingClientRect ( ) . left ) . toBe ( 400 ) ;
677677 } ) ) ;
678678
679- it ( 'fix for #2798 - Allow canceling of open and close of IgxDropDown through onOpening and onClosing events' , fakeAsync ( ( ) => {
679+ it ( '#2798 - Allow canceling of open and close of IgxDropDown through onOpening and onClosing events' , fakeAsync ( ( ) => {
680680 const fix = TestBed . createComponent ( SimpleRefComponent ) ;
681681 fix . detectChanges ( ) ;
682682 const overlayInstance = fix . componentInstance . overlay ;
@@ -713,7 +713,7 @@ describe('igxOverlay', () => {
713713 expect ( overlayInstance . onOpened . emit ) . toHaveBeenCalledTimes ( 1 ) ;
714714 } ) ) ;
715715
716- it ( 'fix for #3673 - Should not close dropdown in dropdown' , fakeAsync ( ( ) => {
716+ it ( '#3673 - Should not close dropdown in dropdown' , fakeAsync ( ( ) => {
717717 const fix = TestBed . createComponent ( EmptyPageComponent ) ;
718718 const button = fix . componentInstance . buttonElement ;
719719 const overlay = fix . componentInstance . overlay ;
@@ -749,7 +749,7 @@ describe('igxOverlay', () => {
749749 expect ( overlayDiv . children [ 0 ] . localName ) . toEqual ( 'div' ) ;
750750 } ) ) ;
751751
752- it ( 'fix for #3743 - Reposition correctly resized element.' , ( ) => {
752+ it ( '#3743 - Reposition correctly resized element.' , ( ) => {
753753 const fixture = TestBed . createComponent ( TopLeftOffsetComponent ) ;
754754 fixture . detectChanges ( ) ;
755755
@@ -801,7 +801,7 @@ describe('igxOverlay', () => {
801801 document . body . removeChild ( wrapperElement ) ;
802802 } ) ;
803803
804- it ( 'Fix for #3988 - Should use ngModuleRef to create component' , inject ( [ ApplicationRef ] , ( appRef : ApplicationRef ) => {
804+ it ( '#3988 - Should use ngModuleRef to create component' , inject ( [ ApplicationRef ] , ( appRef : ApplicationRef ) => {
805805 const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
806806 const overlay = fixture . componentInstance . overlay ;
807807 fixture . detectChanges ( ) ;
@@ -825,6 +825,46 @@ describe('igxOverlay', () => {
825825 expect ( appRef . attachView ) . toHaveBeenCalledWith ( 'test' ) ;
826826 expect ( overlay . getOverlayById ( id ) . componentRef as any ) . toBe ( mockComponent ) ;
827827 } ) ) ;
828+
829+ it ( '##6474 - should calculate correctly position' , ( ) => {
830+ const elastic : ElasticPositionStrategy = new ElasticPositionStrategy ( ) ;
831+ const targetRect : ClientRect = {
832+ top : 100 ,
833+ bottom : 200 ,
834+ height : 100 ,
835+ left : 100 ,
836+ right : 200 ,
837+ width : 100
838+ } ;
839+ const elementRect : ClientRect = {
840+ top : 0 ,
841+ bottom : 300 ,
842+ height : 300 ,
843+ left : 0 ,
844+ right : 300 ,
845+ width : 300
846+ } ;
847+ const viewPortRect : ClientRect = {
848+ top : 1000 ,
849+ bottom : 1300 ,
850+ height : 300 ,
851+ left : 1000 ,
852+ right : 1300 ,
853+ width : 300
854+ } ;
855+ spyOn < any > ( elastic , 'setStyle' ) . and . returnValue ( { } ) ;
856+ spyOn ( Util , 'getViewportRect' ) . and . returnValue ( viewPortRect ) ;
857+ spyOn ( Util , 'getTargetRect' ) . and . returnValue ( targetRect ) ;
858+
859+ const element = jasmine . createSpyObj ( 'HTMLElement' , [ 'getBoundingClientRect' ] ) ;
860+ spyOn ( element , 'getBoundingClientRect' ) . and . returnValue ( elementRect ) ;
861+ element . classList = { add : ( ) => { } } ;
862+ element . style = { width : '' , height : '' } ;
863+ elastic . position ( element , null , null , true ) ;
864+
865+ expect ( element . style . width ) . toBe ( '200px' ) ;
866+ expect ( element . style . height ) . toBe ( '100px' ) ;
867+ } ) ;
828868 } ) ;
829869
830870 describe ( 'Unit Tests - Scroll Strategies: ' , ( ) => {
@@ -2617,7 +2657,7 @@ describe('igxOverlay', () => {
26172657 tick ( ) ;
26182658 } ) ) ;
26192659
2620- // Test fix for #1883 #1820
2660+ // Test #1883 #1820
26212661 it ( 'It should close the component when esc key is pressed and there were other keys pressed prior to esc.' , fakeAsync ( ( ) => {
26222662 const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
26232663 const overlay = fixture . componentInstance . overlay ;
0 commit comments