Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
6736a5bc
Commit
6736a5bc
authored
Jul 03, 2015
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test carbons of user's own sent messages.
Found and fixed a bug in the process.
parent
0afa7ec1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
converse.js
converse.js
+1
-0
spec/chatbox.js
spec/chatbox.js
+39
-0
No files found.
converse.js
View file @
6736a5bc
...
@@ -3319,6 +3319,7 @@
...
@@ -3319,6 +3319,7 @@
}
else
if
(
$sent
.
length
)
{
}
else
if
(
$sent
.
length
)
{
$message
=
$sent
.
children
(
'
forwarded
'
).
children
(
'
message
'
);
$message
=
$sent
.
children
(
'
forwarded
'
).
children
(
'
message
'
);
from_jid
=
$message
.
attr
(
'
from
'
);
from_jid
=
$message
.
attr
(
'
from
'
);
to_jid
=
$message
.
attr
(
'
to
'
);
}
}
from_bare_jid
=
Strophe
.
getBareJidFromJid
(
from_jid
);
from_bare_jid
=
Strophe
.
getBareJidFromJid
(
from_jid
);
from_resource
=
Strophe
.
getResourceFromJid
(
from_jid
);
from_resource
=
Strophe
.
getResourceFromJid
(
from_jid
);
...
...
spec/chatbox.js
View file @
6736a5bc
...
@@ -514,6 +514,45 @@
...
@@ -514,6 +514,45 @@
expect
(
sender_txt
.
match
(
/^
[
0-9
][
0-9
]
:
[
0-9
][
0-9
]
/
)).
toBeTruthy
();
expect
(
sender_txt
.
match
(
/^
[
0-9
][
0-9
]
:
[
0-9
][
0-9
]
/
)).
toBeTruthy
();
});
});
it
(
"
can be a carbon message that this user sent from a different client, as defined in XEP-0280
"
,
function
()
{
// Send a message from a different resource
spyOn
(
converse
,
'
log
'
);
var
msgtext
=
'
This is a sent carbon message
'
;
var
recipient_jid
=
mock
.
cur_names
[
5
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
msg
=
$msg
({
'
from
'
:
converse
.
bare_jid
,
'
id
'
:
(
new
Date
()).
getTime
(),
'
to
'
:
converse
.
connection
.
jid
,
'
type
'
:
'
chat
'
,
'
xmlns
'
:
'
jabber:client
'
}).
c
(
'
sent
'
,
{
'
xmlns
'
:
'
urn:xmpp:carbons:2
'
})
.
c
(
'
forwarded
'
,
{
'
xmlns
'
:
'
urn:xmpp:forward:0
'
})
.
c
(
'
message
'
,
{
'
xmlns
'
:
'
jabber:client
'
,
'
from
'
:
converse
.
bare_jid
+
'
/another-resource
'
,
'
to
'
:
recipient_jid
,
'
type
'
:
'
chat
'
}).
c
(
'
body
'
).
t
(
msgtext
).
tree
();
converse
.
chatboxes
.
onMessage
(
msg
);
// Check that the chatbox and its view now exist
var
chatbox
=
converse
.
chatboxes
.
get
(
recipient_jid
);
var
chatboxview
=
converse
.
chatboxviews
.
get
(
recipient_jid
);
expect
(
chatbox
).
toBeDefined
();
expect
(
chatboxview
).
toBeDefined
();
// Check that the message was received and check the message parameters
expect
(
chatbox
.
messages
.
length
).
toEqual
(
1
);
var
msg_obj
=
chatbox
.
messages
.
models
[
0
];
expect
(
msg_obj
.
get
(
'
message
'
)).
toEqual
(
msgtext
);
expect
(
msg_obj
.
get
(
'
fullname
'
)).
toEqual
(
mock
.
cur_names
[
5
].
split
(
'
'
)[
0
]);
expect
(
msg_obj
.
get
(
'
sender
'
)).
toEqual
(
'
me
'
);
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
false
);
// Now check that the message appears inside the chatbox in the DOM
var
$chat_content
=
chatboxview
.
$el
.
find
(
'
.chat-content
'
);
var
msg_txt
=
$chat_content
.
find
(
'
.chat-message
'
).
find
(
'
.chat-message-content
'
).
text
();
expect
(
msg_txt
).
toEqual
(
msgtext
);
});
it
(
"
received for a minimized chat box will increment a counter on its header
"
,
$
.
proxy
(
function
()
{
it
(
"
received for a minimized chat box will increment a counter on its header
"
,
$
.
proxy
(
function
()
{
var
contact_name
=
mock
.
cur_names
[
0
];
var
contact_name
=
mock
.
cur_names
[
0
];
var
contact_jid
=
contact_name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
contact_jid
=
contact_name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment