mirror of https://github.com/vector-im/riot-web
				
				
				
			
							parent
							
								
									37a0957285
								
							
						
					
					
						commit
						935f95fcde
					
				| 
						 | 
					@ -40,7 +40,6 @@ import "fake-indexeddb/auto";
 | 
				
			||||||
import {cleanLocalstorage} from "../test-utils";
 | 
					import {cleanLocalstorage} from "../test-utils";
 | 
				
			||||||
import {IndexedDBCryptoStore} from "matrix-js-sdk/src/crypto/store/indexeddb-crypto-store";
 | 
					import {IndexedDBCryptoStore} from "matrix-js-sdk/src/crypto/store/indexeddb-crypto-store";
 | 
				
			||||||
import { RoomView as RoomViewClass } from 'matrix-react-sdk/src/components/structures/RoomView';
 | 
					import { RoomView as RoomViewClass } from 'matrix-react-sdk/src/components/structures/RoomView';
 | 
				
			||||||
import LoginComponent from 'matrix-react-sdk/src/components/structures/auth/Login';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const DEFAULT_HS_URL='http://my_server';
 | 
					const DEFAULT_HS_URL='http://my_server';
 | 
				
			||||||
const DEFAULT_IS_URL='http://my_is';
 | 
					const DEFAULT_IS_URL='http://my_is';
 | 
				
			||||||
| 
						 | 
					@ -96,7 +95,7 @@ describe('loading:', function() {
 | 
				
			||||||
     * TODO: it would be nice to factor some of this stuff out of index.js so
 | 
					     * TODO: it would be nice to factor some of this stuff out of index.js so
 | 
				
			||||||
     * that we can test it rather than our own implementation of it.
 | 
					     * that we can test it rather than our own implementation of it.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    function loadApp(opts?) {
 | 
					    function loadApp(opts) {
 | 
				
			||||||
        opts = opts || {};
 | 
					        opts = opts || {};
 | 
				
			||||||
        const queryString = opts.queryString || "";
 | 
					        const queryString = opts.queryString || "";
 | 
				
			||||||
        const uriFragment = opts.uriFragment || "";
 | 
					        const uriFragment = opts.uriFragment || "";
 | 
				
			||||||
| 
						 | 
					@ -166,7 +165,7 @@ describe('loading:', function() {
 | 
				
			||||||
    // http requests until we do.
 | 
					    // http requests until we do.
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    // returns a promise resolving to the received request
 | 
					    // returns a promise resolving to the received request
 | 
				
			||||||
    async function expectAndAwaitSync(opts?) {
 | 
					    async function expectAndAwaitSync(opts) {
 | 
				
			||||||
        let syncRequest = null;
 | 
					        let syncRequest = null;
 | 
				
			||||||
        const isGuest = opts && opts.isGuest;
 | 
					        const isGuest = opts && opts.isGuest;
 | 
				
			||||||
        if (!isGuest) {
 | 
					        if (!isGuest) {
 | 
				
			||||||
| 
						 | 
					@ -635,7 +634,7 @@ describe('loading:', function() {
 | 
				
			||||||
    async function completeLogin(matrixChat) {
 | 
					    async function completeLogin(matrixChat) {
 | 
				
			||||||
        // we expect a single <Login> component
 | 
					        // we expect a single <Login> component
 | 
				
			||||||
        const login = ReactTestUtils.findRenderedComponentWithType(
 | 
					        const login = ReactTestUtils.findRenderedComponentWithType(
 | 
				
			||||||
            matrixChat, LoginComponent);
 | 
					            matrixChat, sdk.getComponent('structures.auth.Login'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // When we switch to the login component, it'll hit the login endpoint
 | 
					        // When we switch to the login component, it'll hit the login endpoint
 | 
				
			||||||
        // for proof of life and to get flows. We'll only give it one option.
 | 
					        // for proof of life and to get flows. We'll only give it one option.
 | 
				
			||||||
| 
						 | 
					@ -675,7 +674,7 @@ describe('loading:', function() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// assert that we are on the loading page
 | 
					// assert that we are on the loading page
 | 
				
			||||||
function assertAtLoadingSpinner(matrixChat) {
 | 
					function assertAtLoadingSpinner(matrixChat) {
 | 
				
			||||||
    const domComponent = ReactDOM.findDOMNode(matrixChat) as Element;
 | 
					    const domComponent = ReactDOM.findDOMNode(matrixChat);
 | 
				
			||||||
    expect(domComponent.className).toEqual("mx_MatrixChat_splash");
 | 
					    expect(domComponent.className).toEqual("mx_MatrixChat_splash");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // just the spinner
 | 
					    // just the spinner
 | 
				
			||||||
| 
						 | 
					@ -693,14 +692,14 @@ function awaitLoggedIn(matrixChat) {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            console.log(Date.now() + ": Received on_logged_in action");
 | 
					            console.log(Date.now() + ": Received on_logged_in action");
 | 
				
			||||||
            dis.unregister(dispatcherRef);
 | 
					            dis.unregister(dispatcherRef);
 | 
				
			||||||
            resolve(undefined);
 | 
					            resolve();
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        const dispatcherRef = dis.register(onAction);
 | 
					        const dispatcherRef = dis.register(onAction);
 | 
				
			||||||
        console.log(Date.now() + ": Waiting for on_logged_in action");
 | 
					        console.log(Date.now() + ": Waiting for on_logged_in action");
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function awaitRoomView(matrixChat, retryLimit?, retryCount?) {
 | 
					function awaitRoomView(matrixChat, retryLimit, retryCount) {
 | 
				
			||||||
    if (retryLimit === undefined) {
 | 
					    if (retryLimit === undefined) {
 | 
				
			||||||
        retryLimit = 5;
 | 
					        retryLimit = 5;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -727,13 +726,13 @@ function awaitRoomView(matrixChat, retryLimit?, retryCount?) {
 | 
				
			||||||
    return Promise.resolve();
 | 
					    return Promise.resolve();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function awaitLoginComponent(matrixChat, attempts?) {
 | 
					function awaitLoginComponent(matrixChat, attempts) {
 | 
				
			||||||
    return MatrixReactTestUtils.waitForRenderedComponentWithType(
 | 
					    return MatrixReactTestUtils.waitForRenderedComponentWithType(
 | 
				
			||||||
        matrixChat, sdk.getComponent('structures.auth.Login'), attempts,
 | 
					        matrixChat, sdk.getComponent('structures.auth.Login'), attempts,
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function awaitWelcomeComponent(matrixChat, attempts?) {
 | 
					function awaitWelcomeComponent(matrixChat, attempts) {
 | 
				
			||||||
    return MatrixReactTestUtils.waitForRenderedComponentWithType(
 | 
					    return MatrixReactTestUtils.waitForRenderedComponentWithType(
 | 
				
			||||||
        matrixChat, sdk.getComponent('auth.Welcome'), attempts,
 | 
					        matrixChat, sdk.getComponent('auth.Welcome'), attempts,
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue