Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove onload simulator from loading test #4314

Merged
merged 1 commit into from
Jun 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 3 additions & 28 deletions test/app-tests/loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,14 @@ 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);
}
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
Expand All @@ -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);
Expand All @@ -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
Expand Down