Commit graph

121 commits

Author SHA1 Message Date
Luke Barnard
f7145941fd Add tests to assert correct MD mention link stripping
Tab-completed @Mentions should only be sent as display names in the `body` of the event. The HTML should be unaffected, and always sent as an anchor tag.
2017-07-24 14:42:20 +01:00
Richard van der Hoff
0d7cc59d99 replace q method calls with bluebird ones
```
find src test -name '*.js' |
    xargs perl -i -pe 's/q\.(all|defer|reject|delay|try|isFulfilled)\(/Promise.$1(/'
```
2017-07-12 18:05:40 +01:00
Richard van der Hoff
0254d2b3a2 q(...) -> Promise.resolve
```
find src test -name '*.js' | xargs perl -i -pe 's/\b[qQ]\(/Promise.resolve(/'
```
2017-07-12 18:05:08 +01:00
Richard van der Hoff
a06bd84213 replace imports of q with bluebird
update `package.json`

```
find src test -name '*.js' |
   xargs perl -i -pe 'if (/require\(.[qQ].\)/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'

find src test -name '*.js' |
   xargs perl -i -pe 'if (/import [qQ]/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'
```
2017-07-12 18:05:08 +01:00
Richard van der Hoff
7455002b1a InteractiveAuthDialogTest: increase timeout
Blindly increase the number of attempts, because it's failing on travis, but
not on my dev box...
2017-07-12 00:24:00 +01:00
Richard van der Hoff
ab61b6b1b6 Use matrix-react-test-utils rather than our own impl
waitForRenderedDOMComponentWithTag is now in matrix-react-test-utils.
2017-07-11 23:14:56 +01:00
Luke Barnard
3bab720a7b Merge pull request #1208 from matrix-org/rav/timelinepanel_test_flakiness
Fix a flaky test in the timelinepanel code
2017-07-11 18:10:55 +01:00
Richard van der Hoff
1139dd2be5 Fix a flaky test in the timelinepanel code
Sometimes it was possible for there to be a scroll event before the initial
pagination completed, which then upset the rest of the test. Just give it a few
ms to sort itself out instead.
2017-07-11 17:34:46 +01:00
Luke Barnard
c9df079464 Merge pull request #1176 from matrix-org/luke/feature-enable-RTE
Take RTE out of labs! 🎉
2017-07-10 13:56:00 +01:00
Richard van der Hoff
167ce88a80 Rewrite ScrollPanel test
It turns out that Chrome now implements scroll-anchoring itself (ie, content
stays in the same place when you add more stuff off-screen), which means we
cannot rely on back-pagination to make ScrollPanel do a scroll.

Instead, just do a scrollToToken. Which turns out to be considerably simpler
anyway.
2017-07-05 14:34:25 +01:00
Luke Barnard
e3f2eb5232 Take RTE out of labs! 🎉
This stops react-sdk from tracking any state previously stored for the purposes of enabling or disabling the lab feature that enabled the new MessageComposer. It is now enabled permanently.

This is being done with the hope that we can get more feedback for it so that when we release we can be confident that people will be OK with the changes it brings.
2017-07-04 14:44:55 +01:00
Luke Barnard
030358e764 Clarify test names 2017-06-30 12:56:19 +01:00
Luke Barnard
80a73a50f5 Update tests
When sending the letter "a" we expect it to be sent as a text message when RTE is enabled because we now detect that there is no formatting or styled blocks in the composer. We also expect emoji to be sent as plaintext if there is no formatting
2017-06-30 12:39:08 +01:00
Luke Barnard
004d4828f8 Make the tests pass
sendTextMessage is not called when RTE Markdown is enabled, but rather sendHtmlMessage
2017-06-23 17:08:37 +01:00
Richard van der Hoff
57b4c422b1 Merge pull request #1061 from matrix-org/rav/megolm_key_encryption_errors
Improve error logging/reporting in megolm import/export
2017-06-12 10:09:52 +01:00
Luke Barnard
3218cae6e3 Expect to join by alias if given to RVS 2017-06-08 17:47:48 +01:00
Richard van der Hoff
b16e652acc rewrite MegolmExportEncryption using async/await
... to make it easier to add exception handling
2017-06-08 14:45:01 +01:00
Richard van der Hoff
d9bc8ebc53 de-lint MegolmExportEncryption + test 2017-06-08 14:29:53 +01:00
Luke Barnard
619830617a Merge branch 'develop' into luke/ilag-i18n
In order to get ILAG internationalised

Conflicts:
	src/components/structures/LoggedInView.js
	src/components/structures/MatrixChat.js
	src/components/views/dialogs/ChatCreateOrReuseDialog.js
	src/components/views/dialogs/SetDisplayNameDialog.js
	src/createRoom.js
	src/i18n/strings/en_EN.json
2017-06-05 16:08:03 +01:00
Luke Barnard
7808994b71 Modify RVS test to wait until room loaded
This allows for the alias resolution to occur before a join is attempted. In theory, join_room could in future do an optional view_room-esque thing before attemping a join which would be less fragile than dispatching things in the right order.

Also, make sure the store indicates that it is not loading when a room ID has been used - no alias resolution need take place.
2017-06-02 09:22:48 +01:00
Marcel
1b35f816fb Fix languages.json 2017-06-01 21:10:32 +02:00
Marcel
46750c4b9b Fix tests for PR #989 2017-06-01 20:40:27 +02:00
Matthew Hodgson
5c885922d9 Merge branch 'develop' into new-guest-access 2017-05-28 22:58:18 +01:00
David Baker
bb344740dd Add test languages file 2017-05-26 13:09:29 +01:00
David Baker
0de0b8954d Trailing whitespace 2017-05-26 12:03:36 +01:00
David Baker
e44f3cc709 Fix tests
* Serve translation files from the karma server
 * Port UserSettingsStore to ES6 exports because the test runner
   gets confused by ES6 importing a commonjs module
 * Remove extra spaces in translations strings for MELS
 * Fix 'his/her' back to be 'their'
 * Change test to expect singular 'invitation' for a single person
   (there may be multiple invitations, but IMO this should be
   'rejected n invitations' and we can play with the wording later,
   I don't think the singular is any worse than the plural).
 * set language in the MELS tests (and wait for it to complete)
 * Don't bother setting lang in other tests for now
2017-05-26 11:58:45 +01:00
David Baker
dfc8cf3f54 Merge branch 'dbkr/dont_put_src_in_resolve_root' into dbkr/translations 2017-05-25 23:16:39 +01:00
David Baker
ba8e37a84e Don't include src in the test resolve root
Don't include src in resolve root for the karma test, as otherwise
modules from react sdk get pulled in instead of npm libraries like
'extend' which breaks everything in really subtle ways.
2017-05-25 23:13:49 +01:00
Luke Barnard
298c5e4df3 Implement a store for RoomView
This allows for a truely flux-y way of storing the currently viewed room, making some callbacks (like onRoomIdResolved) redundant and making sure that the currently viewed room (ID) is only stored in one place as opposed to the previous many places.

This was required for the `join_room` action which can be dispatched to join the currently viewed room.

Another change was to introduce `LifeCycleStore` which is a start at encorporating state related to the lifecycle of the app into a flux store. Currently it only contains an action which will be dispatched when the sync state has become PREPARED. This was necessary to do a deferred dispatch of `join_room` following the registration of a PWLU (PassWord-Less User).

The following actions are introduced:
 - RoomViewStore:
    - `view_room`: dispatch to change the currently viewed room ID
    - `join_room`: dispatch to join the currently viewed room
 - LifecycleStore:
    - `do_after_sync_prepared`: dispatch to store an action which will be dispatched when `sync_state` is dispatched with `state = 'PREPARED'`
 - MatrixChat:
    - `sync_state`: dispatched when the sync state changes. Ideally there'd be a SyncStateStore that emitted an `update` upon receiving this, but for now the `LifecycleStore` will listen for `sync_state` directly.
2017-05-24 16:56:13 +01:00
David Baker
d419c42a4f Squash merge https://github.com/matrix-org/matrix-react-sdk/pull/801 2017-05-23 15:16:31 +01:00
Luke Barnard
e1089574ae Write some tests for the RTS UI
Add tests that make assertions about the UI during registration when registration is done with a user recognised as a team member (by the mock rtsClient).
2017-05-17 09:46:17 +01:00
Luke Barnard
5151264f60 Merge branch 'develop' into new-guest-access
Conflicts:
	src/component-index.js
2017-05-11 13:22:30 +01:00
Luke Barnard
bfa3123f9b Combine data-scroll-token and -contained-scroll-tokens
- Instead of using one attribute, use one that might just contain one token
 - Use the first token when tracking a child
 - Mandate that no commas can be in individual tokens
2017-05-04 10:00:13 +01:00
Luke Barnard
13d37e43ff Mock isGuest 2017-05-02 10:14:54 +01:00
David Baker
23c38bd8a3 Put back both done's
mocha takes the exception arg and does the right thing
2017-03-16 17:47:15 +00:00
David Baker
375ae8fb04 Fix password UI auth test
By adding a way to wait a short time for a component to appear in
the DOM, so we don't get flakey failures like this when we change
something to returning a promise that needs to resolve before the
component actually appears.
2017-03-16 17:26:42 +00:00
David Baker
51467506f8 Port registration over to use InteractiveAuth
These changes are moved over from the dbkr/msisdn_signin branch
2017-02-24 11:41:23 +00:00
David Baker
8fc3104507 Replace submit button with a spinner when busy
and update test accordingly
2017-02-13 18:52:33 +00:00
David Baker
6f53b2de2c Merge pull request #663 from matrix-org/rav/fix_tests
Make tests pass on Chrome again
2017-02-01 10:20:30 +00:00
Richard van der Hoff
cd1cf09dc9 Make tests pass on Chrome again
It seems that a number of the tests had started failing when run in
Chrome. They were fine under PhantomJS, but the MegolmExport tests only work
under Chrome, and I need them to work...

Mostly the problems were timing-related, where assumptions made about how
quickly the `then` handler on a promise would be called were no longer
valid. Possibly Chrome 55 has made some changes to the relative priorities of
setTimeout and sendMessage calls.

One of the TimelinePanel tests was failing because it was expecting the contents
of a div to take up more room than they actually were. It's possible this is
something very environment-specific; hopefully the new value will work on a
wider range of machines.

Also some logging tweaks.
2017-01-31 22:40:53 +00:00
Richard van der Hoff
c5f447260a Megolm import: Fix handling of short files
Make sure we throw a sensible error when the body of the data is too short.
2017-01-31 12:30:30 +00:00
Luke Barnard
24e94787dd A lot of linting 2017-01-25 10:52:55 +00:00
Luke Barnard
d5edf26371 Improve comment 2017-01-25 10:39:39 +00:00
Luke Barnard
e9719b1766 Get rid of .only 2017-01-25 09:12:29 +00:00
Luke Barnard
bd106968ce Merge branch 'develop' into luke/fix-join-part-collapsing-causality
Conflicts:
	src/components/structures/MessagePanel.js
2017-01-24 14:22:18 +00:00
David Baker
4d12a65529 Add mocha env for tests in eslint config 2017-01-23 14:16:25 +00:00
Richard van der Hoff
bb7d589287 Merge pull request #617 from matrix-org/rav/megolm_backup
Megolm session import and export
2017-01-19 16:14:18 +00:00
Richard van der Hoff
fdc213cbb8 Megolm export: fix test 2017-01-19 10:44:01 +00:00
Johannes Löthberg
14ead373e2 Add markdown test-cases
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2017-01-18 20:54:34 +01:00
Richard van der Hoff
31df78f946 Use text-encoding-utf-8 as a TextEncoder polyfill
Somebody else seems to have done a good job of polyfilling TextEncoder, so
let's use that.
2017-01-18 11:39:44 +00:00