Skip to content

Commit 76181f4

Browse files
committed
Merge remote-tracking branch 'origin/develop' into rav/bluebird
2 parents 7238c4d + a303e1e commit 76181f4

7 files changed

Lines changed: 40 additions & 104 deletions

File tree

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"lintall": "eslint src/ test/",
4949
"clean": "rimraf lib webapp electron_app/dist",
5050
"prepublish": "npm run build:compile",
51-
"test": "karma start --single-run=true --autoWatch=false --browsers ChromeHeadless --colors=false",
51+
"test": "karma start --single-run=true --autoWatch=false --browsers ChromeHeadless",
5252
"test-multi": "karma start"
5353
},
5454
"dependencies": {
@@ -121,6 +121,7 @@
121121
"karma-mocha": "^0.2.2",
122122
"karma-webpack": "^1.7.0",
123123
"matrix-mock-request": "^1.0.0",
124+
"matrix-react-test-utils": "^0.2.0",
124125
"minimist": "^1.2.0",
125126
"mkdirp": "^0.5.1",
126127
"mocha": "^2.4.5",

‎src/components/structures/RoomSubList.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var RoomNotifs = require('matrix-react-sdk/lib/RoomNotifs');
3030
var FormattingUtils = require('matrix-react-sdk/lib/utils/FormattingUtils');
3131
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
3232
import Modal from 'matrix-react-sdk/lib/Modal';
33+
import KeyCode from 'matrix-react-sdk/lib/KeyCode';
3334

3435
// turn this on for drop & drag console debugging galore
3536
var debug = false;
@@ -151,10 +152,11 @@ var RoomSubList = React.createClass({
151152
}
152153
},
153154

154-
onRoomTileClick(roomId) {
155+
onRoomTileClick(roomId, ev) {
155156
dis.dispatch({
156157
action: 'view_room',
157158
room_id: roomId,
159+
clear_search: (ev && (ev.keyCode == KeyCode.ENTER || ev.keyCode == KeyCode.SPACE)),
158160
});
159161
},
160162

‎src/components/structures/SearchBox.js‎

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ limitations under the License.
1616

1717
'use strict';
1818

19-
var React = require('react');
19+
import React from 'react';
2020
import { _t } from 'matrix-react-sdk/lib/languageHandler';
21-
var sdk = require('matrix-react-sdk')
22-
var dis = require('matrix-react-sdk/lib/dispatcher');
23-
var rate_limited_func = require('matrix-react-sdk/lib/ratelimitedfunc');
24-
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
21+
import KeyCode from 'matrix-react-sdk/lib/KeyCode';
22+
import sdk from 'matrix-react-sdk';
23+
import dis from 'matrix-react-sdk/lib/dispatcher';
24+
import rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc';
25+
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
2526

2627
module.exports = React.createClass({
2728
displayName: 'SearchBox',
@@ -46,18 +47,19 @@ module.exports = React.createClass({
4647
},
4748

4849
onAction: function(payload) {
49-
// Disabling this as I find it really really annoying, and was used to the
50-
// previous behaviour - see https://github.com/vector-im/riot-web/issues/3348
51-
/*
5250
switch (payload.action) {
53-
// Clear up the text field when a room is selected.
5451
case 'view_room':
55-
if (this.refs.search) {
52+
if (this.refs.search && payload.clear_search) {
5653
this._clearSearch();
5754
}
5855
break;
56+
case 'focus_room_filter':
57+
if (this.refs.search) {
58+
this.refs.search.focus();
59+
this.refs.search.select();
60+
}
61+
break;
5962
}
60-
*/
6163
},
6264

6365
onChange: function() {
@@ -86,6 +88,15 @@ module.exports = React.createClass({
8688
}
8789
},
8890

91+
_onKeyDown: function(ev) {
92+
switch (ev.keyCode) {
93+
case KeyCode.ESCAPE:
94+
this._clearSearch();
95+
dis.dispatch({action: 'focus_composer'});
96+
break;
97+
}
98+
},
99+
89100
_clearSearch: function() {
90101
this.refs.search.value = "";
91102
this.onChange();
@@ -135,6 +146,7 @@ module.exports = React.createClass({
135146
className="mx_SearchBox_search"
136147
value={ this.state.searchTerm }
137148
onChange={ this.onChange }
149+
onKeyDown={ this._onKeyDown }
138150
placeholder={ _t('Filter room names') }
139151
/>
140152
];

‎src/skins/vector/css/_components.scss‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
@import "./matrix-react-sdk/views/messages/_RoomAvatarEvent.scss";
4242
@import "./matrix-react-sdk/views/messages/_TextualEvent.scss";
4343
@import "./matrix-react-sdk/views/messages/_UnknownBody.scss";
44+
@import "./matrix-react-sdk/views/rooms/_AppsDrawer.scss";
4445
@import "./matrix-react-sdk/views/rooms/_Autocomplete.scss";
4546
@import "./matrix-react-sdk/views/rooms/_EntityTile.scss";
4647
@import "./matrix-react-sdk/views/rooms/_EventTile.scss";
@@ -56,9 +57,7 @@
5657
@import "./matrix-react-sdk/views/rooms/_RoomSettings.scss";
5758
@import "./matrix-react-sdk/views/rooms/_RoomTile.scss";
5859
@import "./matrix-react-sdk/views/rooms/_SearchableEntityList.scss";
59-
@import "./matrix-react-sdk/views/rooms/_TabCompleteBar.scss";
6060
@import "./matrix-react-sdk/views/rooms/_TopUnreadMessagesBar.scss";
61-
@import "./matrix-react-sdk/views/rooms/_AppsDrawer.scss";
6261
@import "./matrix-react-sdk/views/settings/_DevicesPanel.scss";
6362
@import "./matrix-react-sdk/views/settings/_IntegrationsManager.scss";
6463
@import "./matrix-react-sdk/views/voip/_CallView.scss";

‎src/skins/vector/css/matrix-react-sdk/structures/_RoomStatusBar.scss‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,6 @@ limitations under the License.
140140
cursor: pointer;
141141
}
142142

143-
.mx_RoomStatusBar_tabCompleteBar {
144-
padding-top: 10px;
145-
color: $primary-fg-color;
146-
}
147-
148143
.mx_RoomStatusBar_typingBar {
149144
height: 50px;
150145
line-height: 50px;
@@ -155,26 +150,6 @@ limitations under the License.
155150
display: block;
156151
}
157152

158-
.mx_RoomStatusBar_tabCompleteWrapper {
159-
display: flex;
160-
height: 26px;
161-
}
162-
163-
.mx_RoomStatusBar_tabCompleteWrapper .mx_TabCompleteBar {
164-
flex: 1 1 auto;
165-
}
166-
167-
.mx_RoomStatusBar_tabCompleteEol {
168-
flex: 0 0 auto;
169-
color: $accent-color;
170-
}
171-
172-
.mx_RoomStatusBar_tabCompleteEol object {
173-
vertical-align: middle;
174-
margin-right: 8px;
175-
margin-top: -2px;
176-
}
177-
178153
.mx_MatrixChat_useCompactLayout {
179154
.mx_RoomStatusBar {
180155
min-height: 40px;

‎src/skins/vector/css/matrix-react-sdk/views/rooms/_TabCompleteBar.scss‎

Lines changed: 0 additions & 56 deletions
This file was deleted.

‎test/app-tests/loading.js‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import ReactDOM from 'react-dom';
2323
import ReactTestUtils from 'react-addons-test-utils';
2424
import expect from 'expect';
2525
import Promise from 'bluebird';
26+
import MatrixReactTestUtils from 'matrix-react-test-utils';
2627

2728
import jssdk from 'matrix-js-sdk';
2829

@@ -183,11 +184,8 @@ describe('loading:', function () {
183184
return httpBackend.flush();
184185
}).then(() => {
185186
// Wait for another trip around the event loop for the UI to update
186-
return Promise.delay(10);
187+
return awaitLoginComponent(matrixChat);
187188
}).then(() => {
188-
// we expect a single <Login> component following session load
189-
ReactTestUtils.findRenderedComponentWithType(
190-
matrixChat, sdk.getComponent('structures.login.Login'));
191189
expect(windowLocation.hash).toEqual("#/login");
192190
}).done(done, done);
193191
});
@@ -232,7 +230,7 @@ describe('loading:', function () {
232230
uriFragment: "#/login",
233231
});
234232

235-
return Promise.delay(100).then(() => {
233+
return awaitLoginComponent(matrixChat).then(() => {
236234
// we expect a single <Login> component
237235
ReactTestUtils.findRenderedComponentWithType(
238236
matrixChat, sdk.getComponent('structures.login.Login'));
@@ -366,7 +364,7 @@ describe('loading:', function () {
366364
});
367365

368366
// give the UI a chance to display
369-
return Promise.delay(50);
367+
return awaitLoginComponent(matrixChat);
370368
});
371369

372370
it('shows a login view', function() {
@@ -530,7 +528,7 @@ describe('loading:', function () {
530528

531529
dis.dispatch({ action: 'start_login' });
532530

533-
return Promise.delay(1);
531+
return awaitLoginComponent(matrixChat);
534532
});
535533
});
536534

@@ -607,7 +605,6 @@ describe('loading:', function () {
607605
});
608606
});
609607

610-
611608
// check that we have a Login component, send a 'user:pass' login,
612609
// and await the HTTP requests.
613610
function completeLogin(matrixChat) {
@@ -723,3 +720,9 @@ function awaitRoomView(matrixChat, retryLimit, retryCount) {
723720
matrixChat, sdk.getComponent('structures.RoomView'));
724721
return Promise.resolve();
725722
}
723+
724+
function awaitLoginComponent(matrixChat, attempts) {
725+
return MatrixReactTestUtils.waitForRenderedComponentWithType(
726+
matrixChat, sdk.getComponent('structures.login.Login'), attempts,
727+
);
728+
}

0 commit comments

Comments
 (0)