       $document = _$document_
       $timeout = _$timeout_
       fakeWindow = angular.element($window)
-      sinon.stub(fakeWindow, 'last').returns(fakeWindow)
+      # sinon.stub(fakeWindow, 'last').returns(fakeWindow)
 
       THROTTLE_MILLISECONDS = _THROTTLE_MILLISECONDS_
 
-      origJq = angular.element
-      angular.element = (first, args...) ->
-        if first == $window
-          fakeWindow
-        else
-          origJq(first, args...)
-
-  afterEach ->
-    angular.element = origJq
+  scroll = (container) ->
+    event = $document[0].createEvent 'UIEvent'
+    event.initUIEvent 'scroll', true, true, fakeWindow[0], 1
+
+    container[0].dispatchEvent(event)
 
   it 'waits correct interval between calls to handler', ->
     scroller = """

    el = angular.element(scroller)
    $document.append(el)

    sinon.stub(fakeWindow, 'height').returns(1000)
    scope = $rootScope.$new(true)
    scope.scroll = sinon.spy()
    $compile(el)(scope)
    $timeout.flush() # 'immediate' call is with $timeout ..., 0
    scope.scroll.should.not.have.been.called
    fakeWindow.scroll()
    scope.scroll.should.have.been.calledOnce

    el.remove()

    el = angular.element(scroller)
    $document.append(el)

    scope = $rootScope.$new(true)
    scope.scroll = sinon.spy()
    $compile(el)(scope)
