@@ -915,6 +915,46 @@ describe('igxOverlay', () => {
915915 expect ( scrollStrat . detach ) . toHaveBeenCalledTimes ( 1 ) ;
916916 } ) ) ;
917917
918+ it ( 'Should only call reposition once on scroll - Absolute.' , fakeAsync ( async ( ) => {
919+ TestBed . overrideComponent ( EmptyPageComponent , {
920+ set : {
921+ styles : [ `button {
922+ position: absolute,
923+ bottom: 200%;
924+ }` ]
925+ }
926+ } ) ;
927+ await TestBed . compileComponents ( ) ;
928+ const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
929+ fixture . detectChanges ( ) ;
930+
931+ const scrollStrat = new AbsoluteScrollStrategy ( ) ;
932+ const overlaySettings : OverlaySettings = {
933+ positionStrategy : new GlobalPositionStrategy ( ) ,
934+ scrollStrategy : scrollStrat ,
935+ modal : false ,
936+ closeOnOutsideClick : false
937+ } ;
938+ const overlay = fixture . componentInstance . overlay ;
939+ const scrollSpy = spyOn < any > ( scrollStrat , 'onScroll' ) . and . callThrough ( ) ;
940+ spyOn ( overlay , 'reposition' ) ;
941+ const id = overlay . attach ( SimpleDynamicComponent , overlaySettings ) ;
942+ overlay . show ( id , overlaySettings ) ;
943+ tick ( ) ;
944+
945+ const content = document . getElementsByClassName ( CLASS_OVERLAY_CONTENT ) [ 0 ] ;
946+ content . children [ 0 ] . dispatchEvent ( new Event ( 'scroll' ) ) ;
947+ expect ( scrollSpy ) . toHaveBeenCalledTimes ( 1 ) ;
948+ expect ( overlay . reposition ) . not . toHaveBeenCalled ( ) ;
949+
950+ document . dispatchEvent ( new Event ( 'scroll' ) ) ;
951+ expect ( scrollSpy ) . toHaveBeenCalledTimes ( 2 ) ;
952+ expect ( overlay . reposition ) . toHaveBeenCalledTimes ( 1 ) ;
953+ expect ( overlay . reposition ) . toHaveBeenCalledWith ( id ) ;
954+
955+ overlay . hide ( id ) ;
956+ } ) ) ;
957+
918958 it ( 'Should properly initialize Scroll Strategy - Close.' , fakeAsync ( async ( ) => {
919959 TestBed . overrideComponent ( EmptyPageComponent , {
920960 set : {
0 commit comments