Added passing Mocha test, fixed scrolling 

After I pulled in the latest changes, the scrolling thing wasn't working right anymore. Not sure what happened. I changed it a little and it seems to be working again. Also, added a Mocha test.