Skip to content

Instantly share code, notes, and snippets.

@johnkpaul
Created March 15, 2012 03:08
Show Gist options
  • Save johnkpaul/2041617 to your computer and use it in GitHub Desktop.
Save johnkpaul/2041617 to your computer and use it in GitHub Desktop.
module("sticky scroll integration tests",{
"setup":function(){
this.$el = $("<div class='test-scroll'></div>");
this.$el.appendTo(document.body);
},
"expandDocumentBody":function($el){
$(document.body).css("height","10000px");
},
"shrinkDocumentBody":function($el){
$(document.body).css("height","auto");
},
"teardown":function(){
this.$el.remove();
}
});
asyncTest("using real browser events, scrolled-off class is added when el is out of viewport", function(){
this.expandDocumentBody();
this.$el.stickyScroll();
var self = this;
$(window).scrollTop(5000);
setTimeout(function(){
equals(self.$el.hasClass("scrolled-off"), true);
self.shrinkDocumentBody();
start();
},0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment