Remove onload simulator from loading test
This used to exist to reproduce the functionality in the window.onload handler
in vector/index.js -- which got removed in 31915db
. Having it here is confusing
at best.
This commit is contained in:
parent
5ff59b0c23
commit
4ca009b9f7
1 changed files with 3 additions and 28 deletions
|
@ -99,21 +99,14 @@ describe('loading:', function () {
|
||||||
toString: function() { return this.search + this.hash; },
|
toString: function() { return this.search + this.hash; },
|
||||||
};
|
};
|
||||||
|
|
||||||
let lastLoadedScreen = null;
|
|
||||||
let appLoaded = false;
|
|
||||||
|
|
||||||
let loadCompleteDefer = q.defer();
|
let loadCompleteDefer = q.defer();
|
||||||
loadCompletePromise = loadCompleteDefer.promise;
|
loadCompletePromise = loadCompleteDefer.promise;
|
||||||
|
|
||||||
function onNewScreen(screen) {
|
function onNewScreen(screen) {
|
||||||
console.log(Date.now() + " newscreen "+screen);
|
console.log(Date.now() + " newscreen "+screen);
|
||||||
if (!appLoaded) {
|
var hash = '#/' + screen;
|
||||||
lastLoadedScreen = screen;
|
windowLocation.hash = hash;
|
||||||
} else {
|
console.log(Date.now() + " browser URI now "+ windowLocation);
|
||||||
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
|
// Parse the given window.location and return parameters that can be used when calling
|
||||||
|
@ -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 MatrixChat = sdk.getComponent('structures.MatrixChat');
|
||||||
const fragParts = parseQsFromFragment(windowLocation);
|
const fragParts = parseQsFromFragment(windowLocation);
|
||||||
var params = parseQs(windowLocation);
|
var params = parseQs(windowLocation);
|
||||||
|
@ -151,17 +137,6 @@ describe('loading:', function () {
|
||||||
makeRegistrationUrl={() => {throw new Error('Not implemented');}}
|
makeRegistrationUrl={() => {throw new Error('Not implemented');}}
|
||||||
/>, parentDiv
|
/>, 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
|
// set an expectation that we will get a call to /sync, then flush
|
||||||
|
|
Loading…
Reference in a new issue