@@ -710,6 +710,62 @@ describe("core.dom tests", () => {
710710        } ) ; 
711711    } ) ; 
712712
713+     describe ( "get_scroll_y" ,  function  ( )  { 
714+         it ( "get vertical scroll from window" ,  function  ( done )  { 
715+             jest . replaceProperty ( window ,  "scrollY" ,  2000 ) ; 
716+             expect ( dom . get_scroll_y ( window ) ) . toBe ( 2000 ) ; 
717+             done ( ) ; 
718+         } ) ; 
719+ 
720+         it ( "get vertical scroll from window when scrollY is 0" ,  function  ( done )  { 
721+             jest . replaceProperty ( window ,  "scrollY" ,  0 ) ; 
722+             expect ( dom . get_scroll_y ( window ) ) . toBe ( 0 ) ; 
723+             done ( ) ; 
724+         } ) ; 
725+ 
726+         it ( "get vertical scroll from an element" ,  function  ( done )  { 
727+             const  el  =  document . createElement ( "div" ) ; 
728+             jest . spyOn ( el ,  "scrollTop" ,  "get" ) . mockReturnValue ( 2000 ) ; 
729+             expect ( dom . get_scroll_y ( el ) ) . toBe ( 2000 ) ; 
730+             done ( ) ; 
731+         } ) ; 
732+ 
733+         it ( "get vertical scroll from an element when scrollTop is 0" ,  function  ( done )  { 
734+             const  el  =  document . createElement ( "div" ) ; 
735+             jest . spyOn ( el ,  "scrollTop" ,  "get" ) . mockReturnValue ( 0 ) ; 
736+             expect ( dom . get_scroll_y ( el ) ) . toBe ( 0 ) ; 
737+             done ( ) ; 
738+         } ) ; 
739+     } ) ; 
740+ 
741+     describe ( "get_scroll_x" ,  function  ( )  { 
742+         it ( "get horizontal scroll from window" ,  function  ( done )  { 
743+             jest . replaceProperty ( window ,  "scrollX" ,  2000 ) ; 
744+             expect ( dom . get_scroll_x ( window ) ) . toBe ( 2000 ) ; 
745+             done ( ) ; 
746+         } ) ; 
747+ 
748+         it ( "get horizontal scroll from window when scrollX is 0" ,  function  ( done )  { 
749+             jest . replaceProperty ( window ,  "scrollX" ,  0 ) ; 
750+             expect ( dom . get_scroll_x ( window ) ) . toBe ( 0 ) ; 
751+             done ( ) ; 
752+         } ) ; 
753+ 
754+         it ( "get horizontal scroll from an element" ,  function  ( done )  { 
755+             const  el  =  document . createElement ( "div" ) ; 
756+             jest . spyOn ( el ,  "scrollLeft" ,  "get" ) . mockReturnValue ( 2000 ) ; 
757+             expect ( dom . get_scroll_x ( el ) ) . toBe ( 2000 ) ; 
758+             done ( ) ; 
759+         } ) ; 
760+ 
761+         it ( "get horizontal scroll from an element when scrollLeft is 0" ,  function  ( done )  { 
762+             const  el  =  document . createElement ( "div" ) ; 
763+             jest . spyOn ( el ,  "scrollLeft" ,  "get" ) . mockReturnValue ( 0 ) ; 
764+             expect ( dom . get_scroll_x ( el ) ) . toBe ( 0 ) ; 
765+             done ( ) ; 
766+         } ) ; 
767+     } ) ; 
768+ 
713769    describe ( "set_data, get_data, delete_data" ,  function  ( )  { 
714770        it ( "can be used to store and retrieve data on DOM nodes." ,  function  ( )  { 
715771            const  el  =  document . createElement ( "div" ) ; 
0 commit comments