@@ -620,14 +620,26 @@ describe('nativeAssetManager', () => {
620620 expect ( win . document . body . innerHTML ) . to . include ( `<a href="http://www.example.com" target="_blank" class="pb-click">new value</a>` ) ;
621621 } ) ;
622622
623+ function getResizeRequest ( ) {
624+ return win . parent . postMessage . args
625+ . map ( ( [ msg ] ) => JSON . parse ( msg ) )
626+ . find ( ( msg ) => msg . action === 'resizeNativeHeight' )
627+ }
628+
623629 it ( 'should not request width resize if width is 1' , ( ) => {
624630 sandbox . stub ( document . body , 'clientWidth' ) . get ( ( ) => 1 ) ;
625631 const nativeAssetManager = makeManager ( ) ;
626632 nativeAssetManager . loadAssets ( AD_ID ) ;
627- const resizeRequest = win . parent . postMessage . args
628- . map ( ( [ msg ] ) => JSON . parse ( msg ) )
629- . find ( ( msg ) => msg . action === 'resizeNativeHeight' )
630- expect ( resizeRequest . width ) . to . not . exist ;
633+ expect ( getResizeRequest ( ) . width ) . to . not . exist ;
634+ } ) ;
635+
636+ it ( 'should use scrollHeight if offsetHeight & clientHeight are 0' , ( ) => {
637+ sandbox . stub ( document . body , 'clientHeight' ) . get ( ( ) => 0 ) ;
638+ sandbox . stub ( document . body , 'offsetHeight' ) . get ( ( ) => 0 ) ;
639+ sandbox . stub ( document . documentElement , 'scrollHeight' ) . get ( ( ) => 123 ) ;
640+ const nativeAssetManager = makeManager ( ) ;
641+ nativeAssetManager . loadAssets ( AD_ID ) ;
642+ expect ( getResizeRequest ( ) . height ) . to . eql ( 123 ) ;
631643 } )
632644
633645 it ( 'should set the iframe to the width of the container' , ( ) => {
0 commit comments