@@ -504,7 +504,7 @@ describe('igxOverlay', () => {
504504 expect ( BaseFitPositionStrategy . prototype . position ) . toHaveBeenCalledTimes ( 3 ) ;
505505 } ) ;
506506
507- it ( 'fix for #1690 - click on second filter does not close first one.' , fakeAsync ( ( ) => {
507+ it ( '#1690 - click on second filter does not close first one.' , fakeAsync ( ( ) => {
508508 const fixture = TestBed . createComponent ( TwoButtonsComponent ) ;
509509 const button1 = fixture . nativeElement . getElementsByClassName ( 'buttonOne' ) [ 0 ] ;
510510 const button2 = fixture . nativeElement . getElementsByClassName ( 'buttonTwo' ) [ 0 ] ;
@@ -521,7 +521,7 @@ describe('igxOverlay', () => {
521521 expect ( overlayDiv . children . length ) . toBe ( 1 ) ;
522522 } ) ) ;
523523
524- it ( 'fix for #1692 - scroll strategy closes overlay when shown component is scrolled.' , fakeAsync ( ( ) => {
524+ it ( '#1692 - scroll strategy closes overlay when shown component is scrolled.' , fakeAsync ( ( ) => {
525525 const fixture = TestBed . createComponent ( SimpleDynamicWithDirectiveComponent ) ;
526526 const overlaySettings : OverlaySettings = { scrollStrategy : new CloseScrollStrategy ( ) } ;
527527 fixture . componentInstance . show ( overlaySettings ) ;
@@ -548,7 +548,7 @@ describe('igxOverlay', () => {
548548 } ) ) ;
549549
550550 // TODO: refactor utilities to include all exported methods in a class
551- it ( 'fix for #1799 - content div should reposition on window resize.' , fakeAsync ( ( ) => {
551+ it ( '#1799 - content div should reposition on window resize.' , fakeAsync ( ( ) => {
552552 const rect : ClientRect = {
553553 bottom : 50 ,
554554 height : 0 ,
@@ -590,7 +590,7 @@ describe('igxOverlay', () => {
590590 overlayInstance . hide ( id ) ;
591591 } ) ) ;
592592
593- it ( 'fix for #2475 - An error is thrown for IgxOverlay when showing a component' +
593+ it ( '#2475 - An error is thrown for IgxOverlay when showing a component' +
594594 'instance that is not attached to the DOM' , fakeAsync ( ( ) => {
595595 const fix = TestBed . createComponent ( SimpleRefComponent ) ;
596596 fix . detectChanges ( ) ;
@@ -611,7 +611,7 @@ describe('igxOverlay', () => {
611611 expect ( contentDiv . classList . contains ( CLASS_OVERLAY_CONTENT_MODAL ) ) . toBeTruthy ( ) ;
612612 } ) ) ;
613613
614- it ( 'fix for #2486 - filtering dropdown is not correctly positioned' , fakeAsync ( ( ) => {
614+ it ( '#2486 - filtering dropdown is not correctly positioned' , fakeAsync ( ( ) => {
615615 const fix = TestBed . createComponent ( WidthTestOverlayComponent ) ;
616616 fix . debugElement . nativeElement . style . transform = 'translatex(100px)' ;
617617
@@ -631,7 +631,7 @@ describe('igxOverlay', () => {
631631 expect ( fix . componentInstance . customComponent . nativeElement . getBoundingClientRect ( ) . left ) . toBe ( 400 ) ;
632632 } ) ) ;
633633
634- it ( 'fix for #2798 - Allow canceling of open and close of IgxDropDown through onOpening and onClosing events' , fakeAsync ( ( ) => {
634+ it ( '#2798 - Allow canceling of open and close of IgxDropDown through onOpening and onClosing events' , fakeAsync ( ( ) => {
635635 const fix = TestBed . createComponent ( SimpleRefComponent ) ;
636636 fix . detectChanges ( ) ;
637637 const overlayInstance = fix . componentInstance . overlay ;
@@ -668,7 +668,7 @@ describe('igxOverlay', () => {
668668 expect ( overlayInstance . onOpened . emit ) . toHaveBeenCalledTimes ( 1 ) ;
669669 } ) ) ;
670670
671- it ( 'fix for #3673 - Should not close dropdown in dropdown' , fakeAsync ( ( ) => {
671+ it ( '#3673 - Should not close dropdown in dropdown' , fakeAsync ( ( ) => {
672672 const fix = TestBed . createComponent ( EmptyPageComponent ) ;
673673 const button = fix . componentInstance . buttonElement ;
674674 const overlay = fix . componentInstance . overlay ;
@@ -704,7 +704,7 @@ describe('igxOverlay', () => {
704704 expect ( overlayDiv . children [ 0 ] . localName ) . toEqual ( 'div' ) ;
705705 } ) ) ;
706706
707- it ( 'fix for #3743 - Reposition correctly resized element.' , ( ) => {
707+ it ( '#3743 - Reposition correctly resized element.' , ( ) => {
708708 const fixture = TestBed . createComponent ( TopLeftOffsetComponent ) ;
709709 fixture . detectChanges ( ) ;
710710
@@ -756,7 +756,7 @@ describe('igxOverlay', () => {
756756 document . body . removeChild ( wrapperElement ) ;
757757 } ) ;
758758
759- it ( 'Fix for #3988 - Should use ngModuleRef to create component' , inject ( [ ApplicationRef ] , ( appRef : ApplicationRef ) => {
759+ it ( '#3988 - Should use ngModuleRef to create component' , inject ( [ ApplicationRef ] , ( appRef : ApplicationRef ) => {
760760 const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
761761 const overlay = fixture . componentInstance . overlay ;
762762 fixture . detectChanges ( ) ;
@@ -780,6 +780,46 @@ describe('igxOverlay', () => {
780780 expect ( appRef . attachView ) . toHaveBeenCalledWith ( 'test' ) ;
781781 expect ( overlay . getOverlayById ( id ) . componentRef as any ) . toBe ( mockComponent ) ;
782782 } ) ) ;
783+
784+ it ( '#6474 - should calculate correctly position' , ( ) => {
785+ const elastic : ElasticPositionStrategy = new ElasticPositionStrategy ( ) ;
786+ const targetRect : ClientRect = {
787+ top : 100 ,
788+ bottom : 200 ,
789+ height : 100 ,
790+ left : 100 ,
791+ right : 200 ,
792+ width : 100
793+ } ;
794+ const elementRect : ClientRect = {
795+ top : 0 ,
796+ bottom : 300 ,
797+ height : 300 ,
798+ left : 0 ,
799+ right : 300 ,
800+ width : 300
801+ } ;
802+ const viewPortRect : ClientRect = {
803+ top : 1000 ,
804+ bottom : 1300 ,
805+ height : 300 ,
806+ left : 1000 ,
807+ right : 1300 ,
808+ width : 300
809+ } ;
810+ spyOn < any > ( elastic , 'setStyle' ) . and . returnValue ( { } ) ;
811+ spyOn ( Util , 'getViewportRect' ) . and . returnValue ( viewPortRect ) ;
812+ spyOn ( Util , 'getTargetRect' ) . and . returnValue ( targetRect ) ;
813+
814+ const element = jasmine . createSpyObj ( 'HTMLElement' , [ 'getBoundingClientRect' ] ) ;
815+ spyOn ( element , 'getBoundingClientRect' ) . and . returnValue ( elementRect ) ;
816+ element . classList = { add : ( ) => { } } ;
817+ element . style = { width : '' , height : '' } ;
818+ elastic . position ( element , null , null , true ) ;
819+
820+ expect ( element . style . width ) . toBe ( '200px' ) ;
821+ expect ( element . style . height ) . toBe ( '100px' ) ;
822+ } ) ;
783823 } ) ;
784824
785825 describe ( 'Unit Tests - Scroll Strategies: ' , ( ) => {
@@ -2532,7 +2572,7 @@ describe('igxOverlay', () => {
25322572 tick ( ) ;
25332573 } ) ) ;
25342574
2535- // Test fix for #1883 #1820
2575+ // Test #1883 #1820
25362576 it ( 'It should close the component when esc key is pressed and there were other keys pressed prior to esc.' , fakeAsync ( ( ) => {
25372577 const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
25382578 const overlay = fixture . componentInstance . overlay ;
0 commit comments