Merge remote-tracking branch 'origin/develop' into rav/bluebird

This commit is contained in:
Richard van der Hoff 2017-07-13 12:04:54 +01:00
commit 76181f4771
7 changed files with 40 additions and 104 deletions

View file

@ -23,6 +23,7 @@ import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-addons-test-utils';
import expect from 'expect';
import Promise from 'bluebird';
import MatrixReactTestUtils from 'matrix-react-test-utils';
import jssdk from 'matrix-js-sdk';
@ -183,11 +184,8 @@ describe('loading:', function () {
return httpBackend.flush();
}).then(() => {
// Wait for another trip around the event loop for the UI to update
return Promise.delay(10);
return awaitLoginComponent(matrixChat);
}).then(() => {
// we expect a single <Login> component following session load
ReactTestUtils.findRenderedComponentWithType(
matrixChat, sdk.getComponent('structures.login.Login'));
expect(windowLocation.hash).toEqual("#/login");
}).done(done, done);
});
@ -232,7 +230,7 @@ describe('loading:', function () {
uriFragment: "#/login",
});
return Promise.delay(100).then(() => {
return awaitLoginComponent(matrixChat).then(() => {
// we expect a single <Login> component
ReactTestUtils.findRenderedComponentWithType(
matrixChat, sdk.getComponent('structures.login.Login'));
@ -366,7 +364,7 @@ describe('loading:', function () {
});
// give the UI a chance to display
return Promise.delay(50);
return awaitLoginComponent(matrixChat);
});
it('shows a login view', function() {
@ -530,7 +528,7 @@ describe('loading:', function () {
dis.dispatch({ action: 'start_login' });
return Promise.delay(1);
return awaitLoginComponent(matrixChat);
});
});
@ -607,7 +605,6 @@ describe('loading:', function () {
});
});
// check that we have a Login component, send a 'user:pass' login,
// and await the HTTP requests.
function completeLogin(matrixChat) {
@ -723,3 +720,9 @@ function awaitRoomView(matrixChat, retryLimit, retryCount) {
matrixChat, sdk.getComponent('structures.RoomView'));
return Promise.resolve();
}
function awaitLoginComponent(matrixChat, attempts) {
return MatrixReactTestUtils.waitForRenderedComponentWithType(
matrixChat, sdk.getComponent('structures.login.Login'), attempts,
);
}