Merge pull request #4314 from vector-im/rav/remove_onload_simulator

Remove onload simulator from loading test
This commit is contained in:
Richard van der Hoff 2017-06-15 14:52:00 +01:00 committed by GitHub
commit 2c8c26a16f

View file

@ -99,22 +99,15 @@ describe('loading:', function () {
toString: function() { return this.search + this.hash; },
};
let lastLoadedScreen = null;
let appLoaded = false;
let loadCompleteDefer = q.defer();
loadCompletePromise = loadCompleteDefer.promise;
function onNewScreen(screen) {
console.log(Date.now() + " newscreen "+screen);
if (!appLoaded) {
lastLoadedScreen = screen;
} else {
var hash = '#/' + screen;
windowLocation.hash = hash;
console.log(Date.now() + " browser URI now "+ windowLocation);
}
}
// Parse the given window.location and return parameters that can be used when calling
// MatrixChat.showScreen(screen, params)
@ -126,13 +119,6 @@ describe('loading:', function () {
}
}
function routeUrl(location, matrixChat) {
console.log(Date.now() + ` routing URL '${location}'`);
const s = getScreenFromLocation(location);
console.log("Showing screen ", s);
matrixChat.showScreen(s.screen, s.params);
}
const MatrixChat = sdk.getComponent('structures.MatrixChat');
const fragParts = parseQsFromFragment(windowLocation);
var params = parseQs(windowLocation);
@ -151,17 +137,6 @@ describe('loading:', function () {
makeRegistrationUrl={() => {throw new Error('Not implemented');}}
/>, parentDiv
);
// pause for a cycle, then simulate the window.onload handler
window.setTimeout(() => {
console.log(Date.now() + " simulating window.onload");
routeUrl(windowLocation, matrixChat);
appLoaded = true;
if (lastLoadedScreen) {
onNewScreen(lastLoadedScreen);
lastLoadedScreen = null;
}
}, 0);
}
// set an expectation that we will get a call to /sync, then flush