Fix test failures introduced by last PR
This commit is contained in:
parent
b0eba8aea8
commit
dcd81da856
3 changed files with 22 additions and 11 deletions
|
@ -153,6 +153,14 @@ module.exports = React.createClass({
|
||||||
if (key == 'readReceipts') {
|
if (key == 'readReceipts') {
|
||||||
var rA = objA[key];
|
var rA = objA[key];
|
||||||
var rB = objB[key];
|
var rB = objB[key];
|
||||||
|
if (rA === rB) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rA || !rB) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (rA.length !== rB.length) {
|
if (rA.length !== rB.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ var TestUtils = require('react-addons-test-utils');
|
||||||
var expect = require('expect');
|
var expect = require('expect');
|
||||||
|
|
||||||
var sdk = require('matrix-react-sdk');
|
var sdk = require('matrix-react-sdk');
|
||||||
|
var MatrixClientPeg = require('MatrixClientPeg');
|
||||||
|
|
||||||
var MessagePanel = sdk.getComponent('structures.MessagePanel');
|
var MessagePanel = sdk.getComponent('structures.MessagePanel');
|
||||||
|
|
||||||
|
@ -35,6 +36,9 @@ describe('MessagePanel', function () {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
test_utils.beforeEach(this);
|
test_utils.beforeEach(this);
|
||||||
sandbox = test_utils.stubClient(sandbox);
|
sandbox = test_utils.stubClient(sandbox);
|
||||||
|
|
||||||
|
var client = MatrixClientPeg.get();
|
||||||
|
client.credentials = {userId: '@me:here'};
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
|
|
|
@ -86,7 +86,8 @@ describe('TimelinePanel', function() {
|
||||||
// this is https://github.com/vector-im/vector-web/issues/1367
|
// this is https://github.com/vector-im/vector-web/issues/1367
|
||||||
|
|
||||||
// enough events to allow us to scroll back
|
// enough events to allow us to scroll back
|
||||||
for (var i = 0; i < 40; i++) {
|
var N_EVENTS = 20;
|
||||||
|
for (var i = 0; i < N_EVENTS; i++) {
|
||||||
timeline.addEvent(mkMessage());
|
timeline.addEvent(mkMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +120,7 @@ describe('TimelinePanel', function() {
|
||||||
// happens
|
// happens
|
||||||
awaitScroll().then(() => {
|
awaitScroll().then(() => {
|
||||||
expect(panel.state.canBackPaginate).toBe(false);
|
expect(panel.state.canBackPaginate).toBe(false);
|
||||||
expect(scryEventTiles(panel).length).toEqual(40);
|
expect(scryEventTiles(panel).length).toEqual(N_EVENTS);
|
||||||
|
|
||||||
// scroll up
|
// scroll up
|
||||||
console.log("setting scrollTop = 0");
|
console.log("setting scrollTop = 0");
|
||||||
|
@ -145,12 +146,12 @@ describe('TimelinePanel', function() {
|
||||||
// that won't make much difference, because we don't paginate
|
// that won't make much difference, because we don't paginate
|
||||||
// unless we're at the bottom of the timeline, but a scroll event
|
// unless we're at the bottom of the timeline, but a scroll event
|
||||||
// should be enough to set off a pagination.
|
// should be enough to set off a pagination.
|
||||||
expect(scryEventTiles(panel).length).toEqual(40);
|
expect(scryEventTiles(panel).length).toEqual(N_EVENTS);
|
||||||
|
|
||||||
scrollingDiv.scrollTop = 10;
|
scrollingDiv.scrollTop = 10;
|
||||||
}).delay(0).then(awaitPaginationCompletion).then(() => {
|
}).delay(0).then(awaitPaginationCompletion).then(() => {
|
||||||
expect(scryEventTiles(panel).length).toEqual(41);
|
expect(scryEventTiles(panel).length).toEqual(N_EVENTS+1);
|
||||||
}).done(done);
|
}).done(done, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not paginate forever if there are no events', function(done) {
|
it('should not paginate forever if there are no events', function(done) {
|
||||||
|
@ -204,5 +205,3 @@ describe('TimelinePanel', function() {
|
||||||
}, 0);
|
}, 0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue