Skip to content

Commit

Permalink
Stengthening dd scrolling tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Oct 12, 2012
1 parent b88bd61 commit 14ec125
Showing 1 changed file with 34 additions and 21 deletions.
55 changes: 34 additions & 21 deletions src/dd/tests/unit/assets/dd-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,29 +553,42 @@ YUI.add('dd-tests', function(Y) {
Y.Assert.isInstanceOf(Y.Plugin.DDWinScroll, dd.winscroll, 'WinScroll: WinScroll Instance');


Y.one(window).set('scrollTop', 0);
Y.one(window).set('scrollLeft', 0);
window.scrollTo(0, 0);
_fakeStart(dd);
var self = this,
winHeight = Y.one(window).get('winHeight'),
i = (winHeight - dd.get('node').get('offsetHeight') - 100),
wait = function() {
if (i < (Y.one(window).get('winHeight') - 30)) {
_moveNode(dd, i, true);
i++;
self.wait.call(self, wait, 0);
} else {
self.wait.call(self, function() {
_fakeEnd(dd);
Y.Assert.isTrue((Y.one(window).get('scrollTop') > 0), 'window.scrollTop is not greater than 0');
dd.destroy();
Y.one('#drag').setStyles({ top: '', left: '' });
Y.one(window).set('scrollTop', 0);
Y.one(window).set('scrollLeft', 0);
Y.one('body').setStyle('height', '');
}, 1500);
}
};
win = Y.one(window),
winHeight = win.get('winHeight'),
i = (winHeight - dd.get('node').get('offsetHeight') - 30),
hasScrolled = false,
wait = function() {
if (win.get('scrollTop')) {
hasScrolled = true;
}
if (i < (Y.one(window).get('winHeight') - 30)) {
_moveNode(dd, i, true);
i++;
self.wait.call(self, wait, 0);
} else {
if (win.get('scrollTop')) {
hasScrolled = true;
}
self.wait.call(self, function() {
_fakeEnd(dd);
if (win.get('scrollTop')) {
hasScrolled = true;
}
Y.Assert.isTrue(hasScrolled, 'window.scrollTop was never greater than 0');
dd.destroy();
Y.one('#drag').setStyles({ top: '', left: '' });
window.scrollTo(0, 0);
Y.one('body').setStyle('height', '');
}, 1500);
}
};

win.on('scroll', function() {
hasScrolled = true;
});
this.wait(wait, 0);
},
test_delegate: function() {
Expand Down

0 comments on commit 14ec125

Please sign in to comment.