Update annoying TimelinePanel test

* Actually test what we were supposed to be testing (viz, that we can paginate
  back down after we hit the top of the room)

* Make the cap on the number of events we show in the timeline a configurable
  property, so that we can set it in the test

* Use a smaller cap in the test, so that we have to do less paginating to hit
  the cap, to make the test run quicker.

* add some more logging so that we can see how far it's got if it gets stuck.
This commit is contained in:
Richard van der Hoff 2016-08-24 15:48:19 +01:00
parent 2f0599aae1
commit cdd2902b01
2 changed files with 48 additions and 11 deletions

View file

@ -31,7 +31,6 @@ var KeyCode = require('../../KeyCode');
var PAGINATE_SIZE = 20;
var INITIAL_SIZE = 20;
var TIMELINE_CAP = 250; // the most events to show in a timeline
var DEBUG = false;
@ -82,6 +81,9 @@ var TimelinePanel = React.createClass({
// opacity for dynamic UI fading effects
opacity: React.PropTypes.number,
// maximum number of events to show in a timeline
timelineCap: React.PropTypes.number,
},
statics: {
@ -92,6 +94,12 @@ var TimelinePanel = React.createClass({
roomReadMarkerTsMap: {},
},
getDefaultProps: function() {
return {
timelineCap: 250,
};
},
getInitialState: function() {
var initialReadMarker =
TimelinePanel.roomReadMarkerMap[this.props.room.roomId]
@ -684,7 +692,7 @@ var TimelinePanel = React.createClass({
_loadTimeline: function(eventId, pixelOffset, offsetBase) {
this._timelineWindow = new Matrix.TimelineWindow(
MatrixClientPeg.get(), this.props.room,
{windowLimit: TIMELINE_CAP});
{windowLimit: this.props.timelineCap});
var onLoaded = () => {
this._reloadEvents();