mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
854aed746a
@ -121,14 +121,17 @@ describe('loading:', function () {
|
||||
|
||||
const MatrixChat = sdk.getComponent('structures.MatrixChat');
|
||||
const fragParts = parseQsFromFragment(windowLocation);
|
||||
|
||||
const config = Object.assign({
|
||||
default_hs_url: DEFAULT_HS_URL,
|
||||
default_is_url: DEFAULT_IS_URL,
|
||||
}, opts.config || {});
|
||||
|
||||
var params = parseQs(windowLocation);
|
||||
matrixChat = ReactDOM.render(
|
||||
<MatrixChat
|
||||
onNewScreen={onNewScreen}
|
||||
config={{
|
||||
default_hs_url: DEFAULT_HS_URL,
|
||||
default_is_url: DEFAULT_IS_URL,
|
||||
}}
|
||||
config={config}
|
||||
realQueryParams={params}
|
||||
startingFragmentQueryParams={fragParts.params}
|
||||
enableGuest={true}
|
||||
@ -318,6 +321,40 @@ describe('loading:', function () {
|
||||
}).done(done, done);
|
||||
});
|
||||
|
||||
it("logs in correctly with a Riot Team Server", function() {
|
||||
sdk.setFetch(httpBackend.fetchFn); // XXX: ought to restore this!
|
||||
|
||||
httpBackend.when('GET', '/pushrules').respond(200, {});
|
||||
httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' });
|
||||
|
||||
loadApp({
|
||||
config: {
|
||||
teamServerConfig: {
|
||||
teamServerURL: 'http://my_team_server',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return q.delay(1).then(() => {
|
||||
// we expect a loading spinner while we log into the RTS
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
|
||||
httpBackend.when('GET', 'my_team_server/login').respond(200, {
|
||||
team_token: 'nom',
|
||||
});
|
||||
return httpBackend.flush();
|
||||
}).then(() => {
|
||||
return awaitSyncingSpinner(matrixChat)
|
||||
}).then(() => {
|
||||
// we got a sync spinner - let the sync complete
|
||||
return expectAndAwaitSync();
|
||||
}).then(() => {
|
||||
// once the sync completes, we should have a home page
|
||||
ReactTestUtils.findRenderedComponentWithType(
|
||||
matrixChat, sdk.getComponent('structures.HomePage'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('/#/login link:', function() {
|
||||
beforeEach(function() {
|
||||
loadApp({
|
||||
|
@ -30,6 +30,33 @@ function HttpBackend() {
|
||||
abort: abort,
|
||||
};
|
||||
};
|
||||
|
||||
// very simplistic mapping from the whatwg fetch interface onto the request
|
||||
// interface, so we can use the same mock backend for both.
|
||||
this.fetchFn = function(input, init) {
|
||||
init = init || {};
|
||||
const requestOpts = {
|
||||
uri: input,
|
||||
method: init.method || 'GET',
|
||||
body: init.body,
|
||||
};
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
function callback(err, response, body) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
resolve({
|
||||
ok: response.statusCode >= 200 && response.statusCode < 300,
|
||||
json: () => body,
|
||||
});
|
||||
};
|
||||
|
||||
const req = new Request(requestOpts, callback);
|
||||
console.log(`HTTP backend received request: ${req}`);
|
||||
self.requests.push(req);
|
||||
});
|
||||
};
|
||||
}
|
||||
HttpBackend.prototype = {
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user