title: Jasmine and position of element
body: <p>I want to test if something happens when an element passes the middle of the window. I just do not seem to get it. This is my source file:</p>
  
  <pre><code>        checkIfWorkInMiddle: function(element) {
          var middelOfScreen = this.getMiddleOfScreen();
          var posAboveBottom = this.getPosAboveBottom(element);
          if (posBottomAboveBottom &gt; middelOfScreen) {
              return true;
          }
  </code></pre>
  
  <p>The position of the element depends on the scroll position. When I do my test the element is always below the middleofscreen. How can I changes this in my test? My spec file is as follows:</p>
  
  <pre><code>describe("Get Middle of screen" , function() {
  it('returns true if above the middle of screen' , function() {
      var fakeElement = Object.create( blocks );
      var x = fakeElement.checkIfWorkInMiddle(element);
  
      expect(x).toBeTruthy();
  });
  </code></pre>
  
  <p>});</p>
  
  <p>So this always returns false in the test. What can I do in my test to force posBottomAboveBottom to be a different value. So actually fake a scroll event? I hope my problem is clear?</p>