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
7ad3c385
Commit
7ad3c385
authored
Oct 28, 2015
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename chat-message-* class to chat-msg-*
parent
ca2b40f7
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
61 additions
and
61 deletions
+61
-61
converse.js
converse.js
+1
-1
mockup/chatroom2.html
mockup/chatroom2.html
+10
-10
mockup/index.html
mockup/index.html
+20
-20
sass/_chatbox.scss
sass/_chatbox.scss
+6
-6
sass/_chatrooms.scss
sass/_chatrooms.scss
+1
-1
spec/chatbox.js
spec/chatbox.js
+17
-17
spec/chatroom.js
spec/chatroom.js
+2
-2
src/templates/action.html
src/templates/action.html
+2
-2
src/templates/message.html
src/templates/message.html
+2
-2
No files found.
converse.js
View file @
7ad3c385
...
@@ -1551,7 +1551,7 @@
...
@@ -1551,7 +1551,7 @@
'
username
'
:
username
,
'
username
'
:
username
,
'
message
'
:
''
,
'
message
'
:
''
,
'
extra_classes
'
:
extra_classes
'
extra_classes
'
:
extra_classes
})).
children
(
'
.chat-m
essage
-content
'
).
first
().
text
(
text
)
})).
children
(
'
.chat-m
sg
-content
'
).
first
().
text
(
text
)
.
addHyperlinks
()
.
addHyperlinks
()
.
addEmoticons
(
converse
.
visible_toolbar_buttons
.
emoticons
).
parent
();
.
addEmoticons
(
converse
.
visible_toolbar_buttons
.
emoticons
).
parent
();
},
},
...
...
mockup/chatroom2.html
View file @
7ad3c385
...
@@ -41,27 +41,27 @@
...
@@ -41,27 +41,27 @@
<div
class=
"chat-area"
>
<div
class=
"chat-area"
>
<div
class=
"chat-content"
>
<div
class=
"chat-content"
>
<div
class=
"chat-message "
>
<div
class=
"chat-message "
>
<span
class=
"chat-m
essage
-room"
>
18:50 luke:
</span>
<span
class=
"chat-m
sg
-room"
>
18:50 luke:
</span>
<span
class=
"chat-m
essage
-content"
>
leia: hi :)
</span>
<span
class=
"chat-m
sg
-content"
>
leia: hi :)
</span>
</div>
</div>
<div
class=
"chat-message "
>
<div
class=
"chat-message "
>
<span
class=
"chat-m
essage
-room"
>
19:40 leia:
</span>
<span
class=
"chat-m
sg
-room"
>
19:40 leia:
</span>
<span
class=
"chat-m
essage
-content"
>
<span
class=
"chat-m
sg
-content"
>
I'll be gone for a while, will be back in about an hour
</span>
I'll be gone for a while, will be back in about an hour
</span>
</div>
</div>
<time
class=
"chat-info chat-date"
datetime=
"2013-06-04T00:00:00.000Z"
>
Tue Jun 04 2013
</time>
<time
class=
"chat-info chat-date"
datetime=
"2013-06-04T00:00:00.000Z"
>
Tue Jun 04 2013
</time>
<div
class=
"chat-message "
>
<div
class=
"chat-message "
>
<span
class=
"chat-m
essage
-room"
>
19:40 Obi-wan Kenobi, Jedi Master:
</span>
<span
class=
"chat-m
sg
-room"
>
19:40 Obi-wan Kenobi, Jedi Master:
</span>
<span
class=
"chat-m
essage
-content"
>
<span
class=
"chat-m
sg
-content"
>
I'll be gone for a while, will be back in about an hour
</span>
I'll be gone for a while, will be back in about an hour
</span>
</div>
</div>
<div
class=
"chat-message"
>
<div
class=
"chat-message"
>
<span
class=
"chat-m
essage
-me"
>
19:42 me:
</span>
<span
class=
"chat-m
sg
-me"
>
19:42 me:
</span>
<span
class=
"chat-m
essage
-content"
>
Supercalifragilisticexpialidociousstillnotlongenough
</span>
<span
class=
"chat-m
sg
-content"
>
Supercalifragilisticexpialidociousstillnotlongenough
</span>
</div>
</div>
<div
class=
"chat-message "
>
<div
class=
"chat-message "
>
<span
class=
"chat-m
essage
-room"
>
19:43 Obi-wan Kenobi, Jedi Master:
</span>
<span
class=
"chat-m
sg
-room"
>
19:43 Obi-wan Kenobi, Jedi Master:
</span>
<span
class=
"chat-m
essage
-content"
>
Another message to check that scrolling works.
</span>
<span
class=
"chat-m
sg
-content"
>
Another message to check that scrolling works.
</span>
</div>
</div>
</div>
</div>
<form
class=
"sendXMPPMessage"
action=
""
method=
"post"
>
<form
class=
"sendXMPPMessage"
action=
""
method=
"post"
>
...
...
mockup/index.html
View file @
7ad3c385
...
@@ -298,28 +298,28 @@
...
@@ -298,28 +298,28 @@
<div
class=
"chat-info"
><strong>
/help
</strong>
:This is an info message
</div>
<div
class=
"chat-info"
><strong>
/help
</strong>
:This is an info message
</div>
<div
class=
"chat-info chat-error"
>
This is an error message
</div>
<div
class=
"chat-info chat-error"
>
This is an error message
</div>
<div
class=
"chat-message"
>
<div
class=
"chat-message"
>
<span
class=
"chat-m
essage
-me"
>
09:35 me:
</span>
<span
class=
"chat-m
sg
-me"
>
09:35 me:
</span>
<span
class=
"chat-m
essage
-content"
>
<span
class=
"chat-m
sg
-content"
>
Hello world
Hello world
<span
class=
"icon-smiley"
></span>
<span
class=
"icon-smiley"
></span>
</span>
</span>
</div>
</div>
<div
class=
"chat-message "
>
<div
class=
"chat-message "
>
<span
class=
"chat-msg-author chat-m
essage
-them"
>
19:25 Benedict-John:
</span>
<span
class=
"chat-msg-author chat-m
sg
-them"
>
19:25 Benedict-John:
</span>
<span
class=
"chat-m
essage
-content"
>
Dagsê
</span>
<span
class=
"chat-m
sg
-content"
>
Dagsê
</span>
</div>
</div>
<div
class=
"chat-message"
>
<div
class=
"chat-message"
>
<span
class=
"chat-m
essage
-me"
>
19:39 me:
</span>
<span
class=
"chat-m
sg
-me"
>
19:39 me:
</span>
<span
class=
"chat-m
essage
-content"
>
This is a relatively long message to check that wrapping works as expected.
</span>
<span
class=
"chat-m
sg
-content"
>
This is a relatively long message to check that wrapping works as expected.
</span>
</div>
</div>
<div
class=
"chat-message"
>
<div
class=
"chat-message"
>
<span
class=
"chat-m
essage
-me"
>
19:42 me:
</span>
<span
class=
"chat-m
sg
-me"
>
19:42 me:
</span>
<span
class=
"chat-m
essage
-content"
>
Supercalifragilisticexpialidociousstillnotlongenough
</span>
<span
class=
"chat-m
sg
-content"
>
Supercalifragilisticexpialidociousstillnotlongenough
</span>
</div>
</div>
<div
class=
"chat-info chat-event"
>
JC Brand is busy
</div>
<div
class=
"chat-info chat-event"
>
JC Brand is busy
</div>
<div
class=
"chat-message "
>
<div
class=
"chat-message "
>
<span
class=
"chat-m
essage
-me"
>
19:43 me:
</span>
<span
class=
"chat-m
sg
-me"
>
19:43 me:
</span>
<span
class=
"chat-m
essage
-content"
>
Another message to check that scrolling works.
</span>
<span
class=
"chat-m
sg
-content"
>
Another message to check that scrolling works.
</span>
</div>
</div>
</div>
</div>
...
@@ -374,27 +374,27 @@
...
@@ -374,27 +374,27 @@
<div
class=
"chat-area"
>
<div
class=
"chat-area"
>
<div
class=
"chat-content"
>
<div
class=
"chat-content"
>
<div
class=
"chat-message "
>
<div
class=
"chat-message "
>
<span
class=
"chat-m
essage
-room"
>
18:50 luke:
</span>
<span
class=
"chat-m
sg
-room"
>
18:50 luke:
</span>
<span
class=
"chat-m
essage
-content"
>
leia: hi :)
</span>
<span
class=
"chat-m
sg
-content"
>
leia: hi :)
</span>
</div>
</div>
<div
class=
"chat-message "
>
<div
class=
"chat-message "
>
<span
class=
"chat-m
essage
-room"
>
19:40 leia:
</span>
<span
class=
"chat-m
sg
-room"
>
19:40 leia:
</span>
<span
class=
"chat-m
essage
-content"
>
<span
class=
"chat-m
sg
-content"
>
I'll be gone for a while, will be back in about an hour
</span>
I'll be gone for a while, will be back in about an hour
</span>
</div>
</div>
<time
class=
"chat-info chat-date"
datetime=
"2013-06-04T00:00:00.000Z"
>
Tue Jun 04 2013
</time>
<time
class=
"chat-info chat-date"
datetime=
"2013-06-04T00:00:00.000Z"
>
Tue Jun 04 2013
</time>
<div
class=
"chat-message "
>
<div
class=
"chat-message "
>
<span
class=
"chat-m
essage
-room"
>
19:40 Obi-wan Kenobi, Jedi Master:
</span>
<span
class=
"chat-m
sg
-room"
>
19:40 Obi-wan Kenobi, Jedi Master:
</span>
<span
class=
"chat-m
essage
-content"
>
<span
class=
"chat-m
sg
-content"
>
I'll be gone for a while, will be back in about an hour
</span>
I'll be gone for a while, will be back in about an hour
</span>
</div>
</div>
<div
class=
"chat-message"
>
<div
class=
"chat-message"
>
<span
class=
"chat-m
essage
-me"
>
19:42 me:
</span>
<span
class=
"chat-m
sg
-me"
>
19:42 me:
</span>
<span
class=
"chat-m
essage
-content"
>
Supercalifragilisticexpialidociousstillnotlongenough
</span>
<span
class=
"chat-m
sg
-content"
>
Supercalifragilisticexpialidociousstillnotlongenough
</span>
</div>
</div>
<div
class=
"chat-message "
>
<div
class=
"chat-message "
>
<span
class=
"chat-m
essage
-room"
>
19:43 Obi-wan Kenobi, Jedi Master:
</span>
<span
class=
"chat-m
sg
-room"
>
19:43 Obi-wan Kenobi, Jedi Master:
</span>
<span
class=
"chat-m
essage
-content"
>
Another message to check that scrolling works.
</span>
<span
class=
"chat-m
sg
-content"
>
Another message to check that scrolling works.
</span>
</div>
</div>
</div>
</div>
<form
class=
"sendXMPPMessage"
action=
""
method=
"post"
>
<form
class=
"sendXMPPMessage"
action=
""
method=
"post"
>
...
...
sass/_chatbox.scss
View file @
7ad3c385
...
@@ -88,29 +88,29 @@
...
@@ -88,29 +88,29 @@
max-width
:
100px
;
max-width
:
100px
;
display
:
inline-block
;
display
:
inline-block
;
padding-right
:
3px
;
padding-right
:
3px
;
&
.chat-m
essage
-author
{
&
.chat-m
sg
-author
{
font-weight
:
bold
;
font-weight
:
bold
;
white-space
:
nowrap
;
white-space
:
nowrap
;
float
:
left
;
float
:
left
;
text-overflow
:
ellipsis
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
overflow
:
hidden
;
}
}
&
.chat-m
essage
-them
{
&
.chat-m
sg
-them
{
color
:
$message-them-color
;
color
:
$message-them-color
;
}
}
&
.chat-m
essage
-me
{
&
.chat-m
sg
-me
{
color
:
$link-color
;
color
:
$link-color
;
}
}
&
.chat-m
essage
-content
{
&
.chat-m
sg
-content
{
word-wrap
:
break-word
;
word-wrap
:
break-word
;
}
}
}
}
}
}
.delayed
{
.delayed
{
.chat-m
essage
-them
{
.chat-m
sg
-them
{
color
:
#FB5D50
;
color
:
#FB5D50
;
}
}
.chat-m
essage
-me
{
.chat-m
sg
-me
{
color
:
#7EABBB
;
color
:
#7EABBB
;
}
}
}
}
...
...
sass/_chatrooms.scss
View file @
7ad3c385
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
.mentioned
{
.mentioned
{
font-weight
:
bold
;
font-weight
:
bold
;
}
}
.chat-m
essage
-room
{
.chat-m
sg
-room
{
color
:
$message-them-color
;
color
:
$message-them-color
;
}
}
.participants
{
.participants
{
...
...
spec/chatbox.js
View file @
7ad3c385
...
@@ -453,9 +453,9 @@
...
@@ -453,9 +453,9 @@
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
false
);
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
false
);
// Now check that the message appears inside the chatbox in the DOM
// Now check that the message appears inside the chatbox in the DOM
var
$chat_content
=
chatboxview
.
$el
.
find
(
'
.chat-content
'
);
var
$chat_content
=
chatboxview
.
$el
.
find
(
'
.chat-content
'
);
var
msg_txt
=
$chat_content
.
find
(
'
.chat-message
'
).
find
(
'
.chat-m
essage
-content
'
).
text
();
var
msg_txt
=
$chat_content
.
find
(
'
.chat-message
'
).
find
(
'
.chat-m
sg
-content
'
).
text
();
expect
(
msg_txt
).
toEqual
(
message
);
expect
(
msg_txt
).
toEqual
(
message
);
var
sender_txt
=
$chat_content
.
find
(
'
span.chat-m
essage
-them
'
).
text
();
var
sender_txt
=
$chat_content
.
find
(
'
span.chat-m
sg
-them
'
).
text
();
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
();
}.
bind
(
converse
));
}.
bind
(
converse
));
}.
bind
(
converse
));
}.
bind
(
converse
));
...
@@ -511,9 +511,9 @@
...
@@ -511,9 +511,9 @@
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
false
);
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
false
);
// Now check that the message appears inside the chatbox in the DOM
// Now check that the message appears inside the chatbox in the DOM
var
$chat_content
=
chatboxview
.
$el
.
find
(
'
.chat-content
'
);
var
$chat_content
=
chatboxview
.
$el
.
find
(
'
.chat-content
'
);
var
msg_txt
=
$chat_content
.
find
(
'
.chat-message
'
).
find
(
'
.chat-m
essage
-content
'
).
text
();
var
msg_txt
=
$chat_content
.
find
(
'
.chat-message
'
).
find
(
'
.chat-m
sg
-content
'
).
text
();
expect
(
msg_txt
).
toEqual
(
msgtext
);
expect
(
msg_txt
).
toEqual
(
msgtext
);
var
sender_txt
=
$chat_content
.
find
(
'
span.chat-m
essage
-them
'
).
text
();
var
sender_txt
=
$chat_content
.
find
(
'
span.chat-m
sg
-them
'
).
text
();
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
();
});
});
...
@@ -552,7 +552,7 @@
...
@@ -552,7 +552,7 @@
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
false
);
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
false
);
// Now check that the message appears inside the chatbox in the DOM
// Now check that the message appears inside the chatbox in the DOM
var
$chat_content
=
chatboxview
.
$el
.
find
(
'
.chat-content
'
);
var
$chat_content
=
chatboxview
.
$el
.
find
(
'
.chat-content
'
);
var
msg_txt
=
$chat_content
.
find
(
'
.chat-message
'
).
find
(
'
.chat-m
essage
-content
'
).
text
();
var
msg_txt
=
$chat_content
.
find
(
'
.chat-message
'
).
find
(
'
.chat-m
sg
-content
'
).
text
();
expect
(
msg_txt
).
toEqual
(
msgtext
);
expect
(
msg_txt
).
toEqual
(
msgtext
);
});
});
...
@@ -634,9 +634,9 @@
...
@@ -634,9 +634,9 @@
expect
(
msg_obj
.
get
(
'
fullname
'
)).
toEqual
(
contact_name
.
split
(
'
'
)[
0
]);
expect
(
msg_obj
.
get
(
'
fullname
'
)).
toEqual
(
contact_name
.
split
(
'
'
)[
0
]);
expect
(
msg_obj
.
get
(
'
sender
'
)).
toEqual
(
'
them
'
);
expect
(
msg_obj
.
get
(
'
sender
'
)).
toEqual
(
'
them
'
);
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
true
);
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
true
);
msg_txt
=
$chat_content
.
find
(
'
.chat-message
'
).
find
(
'
.chat-m
essage
-content
'
).
text
();
msg_txt
=
$chat_content
.
find
(
'
.chat-message
'
).
find
(
'
.chat-m
sg
-content
'
).
text
();
expect
(
msg_txt
).
toEqual
(
message
);
expect
(
msg_txt
).
toEqual
(
message
);
sender_txt
=
$chat_content
.
find
(
'
span.chat-m
essage
-them
'
).
text
();
sender_txt
=
$chat_content
.
find
(
'
span.chat-m
sg
-them
'
).
text
();
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
();
message
=
'
This is a current message
'
;
message
=
'
This is a current message
'
;
...
@@ -665,9 +665,9 @@
...
@@ -665,9 +665,9 @@
expect
(
msg_obj
.
get
(
'
fullname
'
)).
toEqual
(
contact_name
.
split
(
'
'
)[
0
]);
expect
(
msg_obj
.
get
(
'
fullname
'
)).
toEqual
(
contact_name
.
split
(
'
'
)[
0
]);
expect
(
msg_obj
.
get
(
'
sender
'
)).
toEqual
(
'
them
'
);
expect
(
msg_obj
.
get
(
'
sender
'
)).
toEqual
(
'
them
'
);
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
false
);
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
false
);
msg_txt
=
$chat_content
.
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
essage
-content
'
).
text
();
msg_txt
=
$chat_content
.
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
sg
-content
'
).
text
();
expect
(
msg_txt
).
toEqual
(
message
);
expect
(
msg_txt
).
toEqual
(
message
);
sender_txt
=
$chat_content
.
find
(
'
span.chat-m
essage
-them
'
).
last
().
text
();
sender_txt
=
$chat_content
.
find
(
'
span.chat-m
sg
-them
'
).
last
().
text
();
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
();
}.
bind
(
converse
));
}.
bind
(
converse
));
...
@@ -683,7 +683,7 @@
...
@@ -683,7 +683,7 @@
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
messages
.
length
,
2
);
expect
(
view
.
model
.
messages
.
length
,
2
);
expect
(
converse
.
emit
.
mostRecentCall
.
args
,
[
'
messageSend
'
,
message
]);
expect
(
converse
.
emit
.
mostRecentCall
.
args
,
[
'
messageSend
'
,
message
]);
expect
(
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
essage
-content
'
).
text
()).
toEqual
(
message
);
expect
(
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
sg
-content
'
).
text
()).
toEqual
(
message
);
}.
bind
(
converse
));
}.
bind
(
converse
));
it
(
"
is sanitized to prevent Javascript injection attacks
"
,
function
()
{
it
(
"
is sanitized to prevent Javascript injection attacks
"
,
function
()
{
...
@@ -694,7 +694,7 @@
...
@@ -694,7 +694,7 @@
spyOn
(
view
,
'
sendMessage
'
).
andCallThrough
();
spyOn
(
view
,
'
sendMessage
'
).
andCallThrough
();
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
var
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
essage
-content
'
);
var
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
sg
-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
<p>This message contains <em>some</em> <b>markup</b></p>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
<p>This message contains <em>some</em> <b>markup</b></p>
'
);
}.
bind
(
converse
));
}.
bind
(
converse
));
...
@@ -707,7 +707,7 @@
...
@@ -707,7 +707,7 @@
spyOn
(
view
,
'
sendMessage
'
).
andCallThrough
();
spyOn
(
view
,
'
sendMessage
'
).
andCallThrough
();
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
var
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
essage
-content
'
);
var
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
sg
-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
This message contains a hyperlink: <a target="_blank" href="http://www.opkode.com">www.opkode.com</a>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
This message contains a hyperlink: <a target="_blank" href="http://www.opkode.com">www.opkode.com</a>
'
);
}.
bind
(
converse
));
}.
bind
(
converse
));
...
@@ -731,7 +731,7 @@
...
@@ -731,7 +731,7 @@
var
message
=
messages
[
i
];
var
message
=
messages
[
i
];
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
var
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
essage
-content
'
);
var
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
sg
-content
'
);
expect
(
msg
.
html
()).
toEqual
(
emoticons
[
i
]);
expect
(
msg
.
html
()).
toEqual
(
emoticons
[
i
]);
}
}
}.
bind
(
converse
));
}.
bind
(
converse
));
...
@@ -745,28 +745,28 @@
...
@@ -745,28 +745,28 @@
var
message
=
"
http://www.opkode.com/'onmouseover='alert(1)'whatever
"
;
var
message
=
"
http://www.opkode.com/'onmouseover='alert(1)'whatever
"
;
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
var
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
essage
-content
'
);
var
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
sg
-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" href="http://www.opkode.com/%27onmouseover=%27alert%281%29%27whatever">http://www.opkode.com/
\'
onmouseover=
\'
alert(1)
\'
whatever</a>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" href="http://www.opkode.com/%27onmouseover=%27alert%281%29%27whatever">http://www.opkode.com/
\'
onmouseover=
\'
alert(1)
\'
whatever</a>
'
);
message
=
'
http://www.opkode.com/"onmouseover="alert(1)"whatever
'
;
message
=
'
http://www.opkode.com/"onmouseover="alert(1)"whatever
'
;
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
essage
-content
'
);
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
sg
-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" href="http://www.opkode.com/%22onmouseover=%22alert%281%29%22whatever">http://www.opkode.com/"onmouseover="alert(1)"whatever</a>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" href="http://www.opkode.com/%22onmouseover=%22alert%281%29%22whatever">http://www.opkode.com/"onmouseover="alert(1)"whatever</a>
'
);
message
=
"
https://en.wikipedia.org/wiki/Ender's_Game
"
;
message
=
"
https://en.wikipedia.org/wiki/Ender's_Game
"
;
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
essage
-content
'
);
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
sg
-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" href="https://en.wikipedia.org/wiki/Ender%27s_Game">https://en.wikipedia.org/wiki/Ender
\'
s_Game</a>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" href="https://en.wikipedia.org/wiki/Ender%27s_Game">https://en.wikipedia.org/wiki/Ender
\'
s_Game</a>
'
);
message
=
"
https://en.wikipedia.org/wiki/Ender%27s_Game
"
;
message
=
"
https://en.wikipedia.org/wiki/Ender%27s_Game
"
;
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
essage
-content
'
);
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-m
sg
-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" href="https://en.wikipedia.org/wiki/Ender%27s_Game">https://en.wikipedia.org/wiki/Ender%27s_Game</a>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" href="https://en.wikipedia.org/wiki/Ender%27s_Game">https://en.wikipedia.org/wiki/Ender%27s_Game</a>
'
);
}.
bind
(
converse
));
}.
bind
(
converse
));
...
...
spec/chatroom.js
View file @
7ad3c385
...
@@ -188,7 +188,7 @@
...
@@ -188,7 +188,7 @@
view
.
onChatRoomMessage
(
message
.
nodeTree
);
view
.
onChatRoomMessage
(
message
.
nodeTree
);
var
$chat_content
=
view
.
$el
.
find
(
'
.chat-content
'
);
var
$chat_content
=
view
.
$el
.
find
(
'
.chat-content
'
);
expect
(
$chat_content
.
find
(
'
.chat-message
'
).
length
).
toBe
(
1
);
expect
(
$chat_content
.
find
(
'
.chat-message
'
).
length
).
toBe
(
1
);
expect
(
$chat_content
.
find
(
'
.chat-m
essage
-content
'
).
text
()).
toBe
(
text
);
expect
(
$chat_content
.
find
(
'
.chat-m
sg
-content
'
).
text
()).
toBe
(
text
);
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
message
'
,
message
.
nodeTree
);
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
message
'
,
message
.
nodeTree
);
}.
bind
(
converse
));
}.
bind
(
converse
));
...
@@ -251,7 +251,7 @@
...
@@ -251,7 +251,7 @@
view
.
onChatRoomMessage
(
message
.
nodeTree
);
view
.
onChatRoomMessage
(
message
.
nodeTree
);
var
$chat_content
=
view
.
$el
.
find
(
'
.chat-content
'
);
var
$chat_content
=
view
.
$el
.
find
(
'
.chat-content
'
);
expect
(
$chat_content
.
find
(
'
.chat-message
'
).
length
).
toBe
(
1
);
expect
(
$chat_content
.
find
(
'
.chat-message
'
).
length
).
toBe
(
1
);
expect
(
$chat_content
.
find
(
'
.chat-m
essage
-content
'
).
last
().
text
()).
toBe
(
text
);
expect
(
$chat_content
.
find
(
'
.chat-m
sg
-content
'
).
last
().
text
()).
toBe
(
text
);
// We don't emit an event if it's our own message
// We don't emit an event if it's our own message
expect
(
converse
.
emit
.
callCount
,
1
);
expect
(
converse
.
emit
.
callCount
,
1
);
}.
bind
(
converse
));
}.
bind
(
converse
));
...
...
src/templates/action.html
View file @
7ad3c385
<div
class=
"chat-message {{extra_classes}}"
data-isodate=
"{{isodate}}"
>
<div
class=
"chat-message {{extra_classes}}"
data-isodate=
"{{isodate}}"
>
<span
class=
"chat-m
essage
-{{sender}}"
>
{{time}} **{{username}}
</span>
<span
class=
"chat-m
sg
-{{sender}}"
>
{{time}} **{{username}}
</span>
<span
class=
"chat-m
essage
-content"
>
{{message}}
</span>
<span
class=
"chat-m
sg
-content"
>
{{message}}
</span>
</div>
</div>
src/templates/message.html
View file @
7ad3c385
<div
class=
"chat-message {{extra_classes}}"
data-isodate=
"{{isodate}}"
data-msgid=
"{{msgid}}"
>
<div
class=
"chat-message {{extra_classes}}"
data-isodate=
"{{isodate}}"
data-msgid=
"{{msgid}}"
>
<span
class=
"chat-m
essage
-{{sender}}"
>
{{time}} {{username}}:
</span>
<span
class=
"chat-m
sg
-{{sender}}"
>
{{time}} {{username}}:
</span>
<span
class=
"chat-m
essage
-content"
>
{{message}}
</span>
<span
class=
"chat-m
sg
-content"
>
{{message}}
</span>
</div>
</div>
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