mirror of https://github.com/vector-im/riot-web
Add more logging to TimelinePanel-test
In an attempt to figure out why this is timing out sometimes, add even more debugging.pull/21833/head
parent
f431e62e6b
commit
8a57881618
|
@ -224,7 +224,7 @@ describe('TimelinePanel', function() {
|
||||||
|
|
||||||
var scrollDefer;
|
var scrollDefer;
|
||||||
var panel = ReactDOM.render(
|
var panel = ReactDOM.render(
|
||||||
<TimelinePanel room={room} onScroll={()=>{scrollDefer.resolve()}} />,
|
<TimelinePanel room={room} onScroll={() => {scrollDefer.resolve()}} />,
|
||||||
parentDiv
|
parentDiv
|
||||||
);
|
);
|
||||||
console.log("TimelinePanel rendered");
|
console.log("TimelinePanel rendered");
|
||||||
|
@ -238,17 +238,29 @@ describe('TimelinePanel', function() {
|
||||||
// the TimelinePanel fires a scroll event
|
// the TimelinePanel fires a scroll event
|
||||||
var awaitScroll = function() {
|
var awaitScroll = function() {
|
||||||
scrollDefer = q.defer();
|
scrollDefer = q.defer();
|
||||||
return scrollDefer.promise;
|
return scrollDefer.promise.then(() => {
|
||||||
|
console.log("got scroll event; scrollTop now " +
|
||||||
|
scrollingDiv.scrollTop);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function setScrollTop(scrollTop) {
|
||||||
|
const before = scrollingDiv.scrollTop;
|
||||||
|
scrollingDiv.scrollTop = scrollTop;
|
||||||
|
console.log("setScrollTop: before update: " + before +
|
||||||
|
"; assigned: " + scrollTop +
|
||||||
|
"; after update: " + scrollingDiv.scrollTop);
|
||||||
|
}
|
||||||
|
|
||||||
function backPaginate() {
|
function backPaginate() {
|
||||||
scrollingDiv.scrollTop = 0;
|
console.log("back paginating...");
|
||||||
|
setScrollTop(0);
|
||||||
return awaitScroll().then(() => {
|
return awaitScroll().then(() => {
|
||||||
if(scrollingDiv.scrollTop > 0) {
|
if(scrollingDiv.scrollTop > 0) {
|
||||||
// need to go further
|
// need to go further
|
||||||
return backPaginate();
|
return backPaginate();
|
||||||
}
|
}
|
||||||
console.log("paginated to end.");
|
console.log("paginated to start.");
|
||||||
|
|
||||||
// hopefully, we got to the start of the timeline
|
// hopefully, we got to the start of the timeline
|
||||||
expect(messagePanel.props.backPaginating).toBe(false);
|
expect(messagePanel.props.backPaginating).toBe(false);
|
||||||
|
@ -262,7 +274,6 @@ describe('TimelinePanel', function() {
|
||||||
expect(messagePanel.props.suppressFirstDateSeparator).toBe(true);
|
expect(messagePanel.props.suppressFirstDateSeparator).toBe(true);
|
||||||
|
|
||||||
// back-paginate until we hit the start
|
// back-paginate until we hit the start
|
||||||
console.log("back paginating...");
|
|
||||||
return backPaginate();
|
return backPaginate();
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
expect(messagePanel.props.suppressFirstDateSeparator).toBe(false);
|
expect(messagePanel.props.suppressFirstDateSeparator).toBe(false);
|
||||||
|
@ -271,8 +282,7 @@ describe('TimelinePanel', function() {
|
||||||
|
|
||||||
// we should now be able to scroll down, and paginate in the other
|
// we should now be able to scroll down, and paginate in the other
|
||||||
// direction.
|
// direction.
|
||||||
console.log("scrollingDiv.scrollTop is " + scrollingDiv.scrollTop);
|
setScrollTop(scrollingDiv.scrollHeight);
|
||||||
console.log("Going to set it to " + scrollingDiv.scrollHeight);
|
|
||||||
scrollingDiv.scrollTop = scrollingDiv.scrollHeight;
|
scrollingDiv.scrollTop = scrollingDiv.scrollHeight;
|
||||||
return awaitScroll();
|
return awaitScroll();
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|
Loading…
Reference in New Issue