Commit Graph

26 Commits

Author SHA1 Message Date
JC Brand
1fa203c990 Support for IndexedDB. updates #1105
Depend on latest backbone.browserStorage which has support for IndexedDB
via localforage.

Storage operations are now asynchronous and transactional.

Bugs fixed (mostly by waiting for operations to complete):

* Rooms are now fetched asynchronously, so wait before triggering `show`
  or when closing.
* Make sure chat create/update transactions complete before firing events
* Make sure chats and messages have been fetched before creating new ones.
* When doing a `fetch` with `wait: false` on a collection and then
  creating a model in that collection, then once the read
  operation finishes (after creating the model), the collection is emptied again.
* Patch and wait when saving.
  Otherwise we have previously set attributes overriding later ones.
* Make sure api.roomviews.close returns a promise

Test fixes:

* Chats are now asynchronously returned, so we need to use `await`
* Wait for the storage transaction to complete when creating and updating messages
* Wait for all chatboxes to close
    Otherwise we get sessionStorage inconsistencies due to the async nature of localforage.
* Wait for room views to close in spec/chatroom.js

In the process, remove the `closeAllChatBoxes` override in
converse-controlbox by letting the `close` method decide whether it
should be closed or not.
2019-10-30 13:02:23 +01:00
JC Brand
877e07775a Remove need to pass in spies to initConverse
They aren't used anymore.
2019-10-11 17:46:13 +02:00
JC Brand
8780f7a128 Fix linting errors (no-unused-vars) 2019-10-09 16:27:58 +02:00
JC Brand
a1630b5c1f Replace wait-until-promise with utility method
and bump default timeout

Also let `_converse.api.waitUntil` use it if a function is passed in.
2019-07-11 23:34:27 +02:00
JC Brand
1a3526f537 Update openAndEnterChatRoom to take JID 2019-07-04 08:28:12 +02:00
JC Brand
98215deb21 Update to latest backbone.overview which debounces sorting on add event 2019-06-27 13:15:55 +02:00
JC Brand
9f5031c278 Make converse.initialize an async function
- Combine all test init functions into `initConverse`
- Use `async` functions in more tests
- Replace `var` with `let` and `const` in more tests
- New utils method `toStanza` which converts a string to a Node
2019-02-12 15:34:50 +01:00
JC Brand
596082eecc Get tests to run agains the webpack build 2018-06-03 16:40:20 +02:00
JC Brand
ce1954a9f7 Improved roster performance.
Don't sort the roster group for each `chat_status` change. Instead batch
every 500ms.
2017-12-20 16:59:17 +00:00
JC Brand
fe6a9ca748 Merge converse-api and converse-core
Otherwise `require('converse-core')` can be called, exposing the inner converse
object.
2017-02-14 14:35:52 +00:00
JC Brand
b7b9711296 Rename the closured converse object to _converse
to indicate that it's private and to differentiate it from the outer "global"
converse object.
2017-02-02 18:34:13 +00:00
JC Brand
de07b6a529 No need for two AMD-load cycles. 2016-11-30 12:18:58 +00:00
JC Brand
a2f4acdcee All tests suites now updated and isolated. 2016-11-03 13:59:05 +00:00
JC Brand
e835a25184 Add jshint checking and fix errors. 2015-10-25 17:55:18 +00:00
JC Brand
3afc0e58bc Bugfixes to make profiling work again. 2015-05-01 14:34:20 +02:00
JC Brand
330b1434bd Completely remove strophe.roster as a dependency. 2015-04-06 20:55:38 +02:00
JC Brand
f283f6bce5 Fix failing tests after introducing AMD version of Strophe 2015-02-01 16:15:34 +01:00
JC Brand
55e32c735d Fix tests 2014-10-27 23:06:11 +01:00
JC Brand
d03a9a0192 bugfix in positionGroup.
Index must always be 0 if there aren't any group elements in the dom yet.
2014-10-26 23:13:04 +01:00
JC Brand
902e833dec Some refactoring. Add showInRoster method
which checks if a contact should appear in the roster (depends on
show_only_online_users setting)
2014-10-26 23:10:43 +01:00
JC Brand
015367af62 Add another profiling method for adding users without groups 2014-10-26 17:12:59 +01:00
JC Brand
3d32bfefc3 Don't add test users alphabetically, but rather randomly 2014-10-25 12:33:08 +02:00
JC Brand
f4ff6370b9 Performance fix. Debounce the update method on the roster. 2014-10-25 09:57:05 +02:00
JC Brand
6088417df7 Add an outline to the profiling tests. 2014-10-24 22:24:05 +02:00
JC Brand
cdb86788a3 Fix tests.
In the previous commit, the mock connection object was refactored to use a real
Strophe.Connection object.

This caused a test in spec/controlbox.js to fail (due to a method that was now
no longer mocked).

Added a quick workaround (via monkeypatch) for now.
2014-10-24 21:45:48 +02:00
JC Brand
5e4d6bd3b2 Initial work on adding profiling tests. 2014-10-24 18:58:42 +02:00