Commit Graph

88 Commits

Author SHA1 Message Date
Pete Nicholls
6002e0fdf9 Use converse.emit to dispatch call button event 2013-12-19 12:26:11 +13:00
Pete Nicholls
db60894834 Add optional call button to chat box toolbar 2013-12-19 12:26:07 +13:00
JC Brand
4186bf3ca3 Throw event onRosterViewUpdated whenever the roster HTML changes. Fixes #101 2013-12-18 16:30:19 +02:00
JC Brand
8633d23738 Sanitize text messages to disable Javascript injection attacks.
Thanks to hejsan.
2013-12-18 13:51:59 +02:00
JC Brand
c8bf0491c8 Add new spec to test converse.js's API. Fixes #48 2013-12-16 20:00:21 +02:00
JC Brand
326e5a188b Rename the spec files 2013-12-16 20:00:15 +02:00
JC Brand
d1bf5b8466 Add event emitter tests for chatrooms. Updates #48 2013-12-16 19:19:25 +02:00
JC Brand
cdc350f592 Add more tests for events emitting. Updates #48 2013-12-16 15:27:07 +02:00
JC Brand
1939ddac23 Test events emitted when own status or status message is changed. Updates #48 2013-12-15 18:13:39 +02:00
JC Brand
7a5bc7fe65 'ask' attribute of 'subscribe' is only for 'pending out' requests.
Did more investigation with regards to subscription requests.

As far as I can tell, roster updates will only show ask='request' for 'pending
out' requests.

For 'pending in' requests (what converse.js calls requesting contacts), roster
updates are not used and instead a presence stanza with type 'subscribe' is
used.

This makes sense. When sending a presence with type 'subscribe', we need a way
to keep track of our outgoing subscriptions. The XMPP server helps us do this by
adding a user to our roster with ask='request' and subscription='none'.

When our contact receives our presence with type 'subscribe', they have the
information they need. If they go offline and online again, the XMPP server
will resend the presence with type 'subscribe'. So a roster item is not needed.

In convere.js's internal representation of the roster (via the RosterItems backbone
object) we need to add roster items for 'pending in' contacts so that we can
render them and we need to know whether they are 'pending in' or 'pending out'.

We already know they're 'pending out' when ask='subscribe' and
subscription='none'. For 'pending in', since these roster items are only stored
locally and not on the XMPP server (because 'pending in' requests are handled
via <presence> stanzas and not the roster) we add a special attribute
'requesting'.
2013-11-06 09:54:58 +02:00
JC Brand
fb8e2cde72 Roster item 'ask' property is always 'subscribe' for subscription requests
* 'pending' state is denoted by subscription='none', ask='subscribe'
* 'requesting' state is denoted by subscription='from', ask='subscribe'

Reference: http://xmpp.org/rfcs/rfc3921.html#int

I'm not yet 100% sure with regards to the 'requesting' state, I can't find
anything about it in the above mentioned reference, but apparantly that's what
prosody's roster response looks like (e.g. <item jid='XYZ' ask='subscribe'
subscription='from'/> ).

With ejabberd I haven't yet received such a roster response and contact
requests are always handled via presence stanzas.

updates #81
2013-11-06 09:04:44 +02:00
JC Brand
fc3a08400e Add tests for the chat toolbar.
Including the emoticon menu and the OTR menu.
More tests needed for OTR in particular.
2013-11-03 22:28:44 +02:00
JC Brand
00e0782576 Add a test that checks for delayed messages. Fixes #76
Messages older than one day do indicate it.
2013-11-03 13:24:18 +02:00
JC Brand
d7d8948eba Refactor ChatRoom tests (move code to utils.js) 2013-11-03 12:02:25 +02:00
JC Brand
13babe4fae Refactored chatbox tests to be run independently 2013-11-03 11:38:48 +02:00
JC Brand
44fe406a34 Refactored tests.
Split MainSpec out into ChatBoxSpec and ControlBoxSpec.

Part of trying to have looser coupling between tests so that they can be run
independently.
2013-11-02 13:37:38 +02:00
JC Brand
b0f12d0f79 $.proxy can be used to pass in extra args, no need for fn.bind 2013-11-02 12:03:57 +02:00
JC Brand
ff345dcf51 Move mock.js to tests dir. Add utils.js
Both changes from tests-refactor branch
2013-11-02 11:32:52 +02:00
JC Brand
38c26013d0 Simplify the boilerplate HTML require even more.
Use id 'conversejs' instead of 'chatpanel'.

The controlbox toggle is now generated via a backbone view, you don't need to
manually include it in your markup.
2013-10-20 22:42:34 +02:00
JC Brand
0deb8be9e7 Fix tests. sendPresence is now sent out at a different place 2013-10-15 21:05:07 +02:00
JC Brand
e883d137fc Bugfixes. RosterItemView didn't rebind events. Undefined vars in onConnect.
When using show_only_online_users, roster item DOM elements are removed from
the DOM if their status changed from 'online' to something else.

When their status changed to 'online' again, they were re-added.

Their views (RosterItemView) instances however didn't listen to events anymore.

Calling delegateEvents on the view after calling $.remove() fixed this.
2013-10-07 09:16:26 +02:00
JC Brand
6d026f010e Fix tests that were broken after vCard changes
Conflicts:
	tests_main.js
2013-10-03 13:51:29 +02:00
JC Brand
7f4bdb4098 Don't use id for controlbox panes 2013-10-03 13:45:50 +02:00
JC Brand
be66284748 Add a test for /clear functionality 2013-09-13 12:18:49 +02:00
JC Brand
cc37d6a183 The xa chat state wasn't being handled properly 2013-09-13 10:57:53 +02:00
JC Brand
b34a706132 We didn't have an icon for unavailable state.
Also, the status description was not translation aware
2013-09-13 10:35:37 +02:00
JC Brand
0a1a837391 Three more tests for pending contacts.
Trying to flesh out the bug where in certain instances the 'pending contacts'
header doesn't get removed after the last pending contact is removed.
2013-08-24 15:33:06 +02:00
JC Brand
bc0e200cee Fixed tests 2013-08-24 03:13:25 +02:00
JC Brand
304b275714 Fix tests. removeRoom method doesn't exist anymore 2013-08-20 22:03:46 +02:00
JC Brand
2d4a14ac2d Don't expose the Strophe connection object globally.
Instead, expose only the initialize and onConnected functions.
Updated the tests to work with this.
2013-08-05 09:25:29 +02:00
JC Brand
c5192f8ade Bugfix. Updates #32
Users without roster contacts didn't have XMPPStatus.initStatus called and
therefore had a default status of offline.

Fixed this by setting the status to online from the start. The fetch command
will get the true status from localStorage (if available).

Made sure that the rest of converse's onConnected code is called in the
callback from fetch (so that we know the user's status is correct).

Updated and fixed tests.
2013-08-04 15:39:46 +02:00
JC Brand
18565e7977 Remove trailing whitespace 2013-07-25 09:45:35 +02:00
JC Brand
4c0d4f2ac5 bugfix. Fixes #26. Only the first minute digit was shown. 2013-07-24 22:58:53 +02:00
JC Brand
8293bd0da5 Bugfix in jquery element query 2013-06-02 22:32:33 +02:00
JC Brand
b350efa646 Fix tests 2013-05-31 21:13:01 +02:00
JC Brand
49b99d9693 Refactored status message rendering code
As a result we now implement more status codes from the spec.
Specifically the codes related to forced removal form the room

Also fixed a bug related to wrong authentication when logging in.
2013-05-30 21:25:54 +02:00
JC Brand
33d85cd955 Fix tests after adding nick input field 2013-05-21 16:49:10 +02:00
JC Brand
d83ffde08d Fix tests after status widget changes 2013-05-21 13:55:42 +02:00
JC Brand
b35d71e22f Test chatroom message 2013-05-14 23:20:59 +02:00
JC Brand
2a7031b504 Make the spec independently testable 2013-05-14 22:45:21 +02:00
JC Brand
d568d90a3a Work to make the individual tests independent 2013-05-14 22:39:13 +02:00
JC Brand
feb3695ebe Tweak the error message styling 2013-05-14 22:13:05 +02:00
JC Brand
946bb7730b Fix tests 2013-05-14 09:43:49 +02:00
JC Brand
cc28f7e827 Add a test to check that moderators are highlighted 2013-05-11 14:34:36 +02:00
JC Brand
6d9fe68a25 Split ChatRooms tests out into their own spec file 2013-05-11 14:20:07 +02:00
JC Brand
7c1a9242d5 Add logic to parse error messages when trying to enter a room 2013-05-11 09:59:32 +02:00
JC Brand
dc6c78331f Bugfix in tests, make sure message counter is cleared 2013-05-09 17:12:51 +02:00
JC Brand
c66c7c3f26 Merge branch 'master' of https://github.com/witekdev/converse.js into witekdev-master
Conflicts:
	spec/MainSpec.js
2013-05-08 18:01:03 +02:00
witek
b84d4519a9 add tests for message counter functionality 2013-05-08 17:42:19 +02:00
JC Brand
be9cd59951 Add chatroom test concerning localstorage 2013-05-08 17:29:18 +02:00