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
dec674fa
Commit
dec674fa
authored
Apr 24, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix. Opened chatboxes weren't focused...
...when clicking on a contact in the roster
parent
30fe6de7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
converse.js
converse.js
+2
-1
spec/chatbox.js
spec/chatbox.js
+21
-2
No files found.
converse.js
View file @
dec674fa
...
...
@@ -1479,11 +1479,12 @@
this
.
$el
.
hide
(
'
fast
'
,
converse
.
refreshWebkit
);
converse
.
emit
(
'
onChatBoxClosed
'
,
this
);
}
return
this
;
},
show
:
function
(
callback
)
{
if
(
this
.
$el
.
is
(
'
:visible
'
)
&&
this
.
$el
.
css
(
'
opacity
'
)
==
"
1
"
)
{
return
this
;
return
this
.
focus
()
;
}
this
.
$el
.
show
(
callback
);
if
(
converse
.
connection
)
{
...
...
spec/chatbox.js
View file @
dec674fa
...
...
@@ -35,7 +35,7 @@
// visible, but no other chat boxes have been created.
expect
(
this
.
chatboxes
.
length
).
toEqual
(
1
);
var
online_contacts
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contacts
'
).
siblings
(
'
dd.current-xmpp-contact
.online
'
).
find
(
'
a.open-chat
'
);
var
online_contacts
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contacts
'
).
siblings
(
'
dd.current-xmpp-contact
'
).
find
(
'
a.open-chat
'
);
for
(
i
=
0
;
i
<
online_contacts
.
length
;
i
++
)
{
$el
=
$
(
online_contacts
[
i
]);
jid
=
$el
.
text
().
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
...
...
@@ -48,6 +48,26 @@
}
},
converse
));
it
(
"
is focused if its already open and you click on its corresponding roster item
"
,
$
.
proxy
(
function
()
{
var
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
i
,
$el
,
click
,
jid
,
view
,
chatboxview
,
chatbox
;
// openControlBox was called earlier, so the controlbox is
// visible, but no other chat boxes have been created.
expect
(
this
.
chatboxes
.
length
).
toEqual
(
1
);
chatbox
=
utils
.
openChatBoxFor
(
contact_jid
);
chatboxview
=
this
.
chatboxviews
.
get
(
contact_jid
);
spyOn
(
chatboxview
,
'
focus
'
);
var
$el
=
this
.
rosterview
.
$el
.
find
(
'
a.open-chat:contains("
'
+
chatbox
.
get
(
'
fullname
'
)
+
'
")
'
);
jid
=
$el
.
text
().
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
view
=
this
.
rosterview
.
get
(
jid
);
spyOn
(
view
,
'
openChat
'
).
andCallThrough
();
view
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
$el
.
click
();
expect
(
view
.
openChat
).
toHaveBeenCalled
();
expect
(
this
.
chatboxes
.
length
).
toEqual
(
2
);
expect
(
chatboxview
.
focus
).
toHaveBeenCalled
();
},
converse
));
it
(
"
can be saved to, and retrieved from, localStorage
"
,
$
.
proxy
(
function
()
{
spyOn
(
converse
,
'
emit
'
);
runs
(
function
()
{
...
...
@@ -527,7 +547,6 @@
utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
messages
.
length
,
2
);
expect
(
converse
.
emit
.
callCount
).
toEqual
(
3
);
expect
(
converse
.
emit
.
mostRecentCall
.
args
,
[
'
onMessageSend
'
,
message
]);
expect
(
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-message-content
'
).
text
()).
toEqual
(
message
);
}.
bind
(
converse
));
...
...
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