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
c66c7c3f
Commit
c66c7c3f
authored
May 08, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/witekdev/converse.js
into witekdev-master
Conflicts: spec/MainSpec.js
parents
be9cd599
b84d4519
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
6 deletions
+53
-6
converse.js
converse.js
+9
-3
spec/MainSpec.js
spec/MainSpec.js
+44
-3
No files found.
converse.js
View file @
c66c7c3f
...
...
@@ -335,7 +335,7 @@
'
extra_classes
'
:
message
.
get
(
'
delayed
'
)
&&
'
delayed
'
||
''
}));
}
if
(
message
.
get
(
'
sender
'
)
!=
'
me
'
)
{
if
(
(
message
.
get
(
'
sender
'
)
!=
'
me
'
)
&&
(
converse
.
windowState
==
'
blur
'
)
)
{
converse
.
incrementMsgCounter
();
}
this
.
scrollDown
();
...
...
@@ -480,7 +480,6 @@
if
(
this
.
model
.
get
(
'
status
'
))
{
this
.
showStatusMessage
(
this
.
model
.
get
(
'
status
'
));
}
converse
.
clearMsgCounter
();
},
template
:
_
.
template
(
...
...
@@ -956,7 +955,6 @@
this
);
this
.
$el
.
appendTo
(
converse
.
chatboxesview
.
$el
);
this
.
render
().
show
().
model
.
messages
.
fetch
({
add
:
true
});
converse
.
clearMsgCounter
();
},
onLeave
:
function
()
{
...
...
@@ -2121,6 +2119,14 @@
this
.
xmppstatus
.
initStatus
();
},
this
));
$
(
window
).
on
(
"
blur focus
"
,
$
.
proxy
(
function
(
e
)
{
if
((
this
.
windowState
!=
e
.
type
)
&&
(
e
.
type
==
'
focus
'
))
{
converse
.
clearMsgCounter
();
}
this
.
windowState
=
e
.
type
;
},
this
))
this
.
giveFeedback
(
'
Online Contacts
'
);
};
...
...
spec/MainSpec.js
View file @
c66c7c3f
...
...
@@ -136,11 +136,9 @@
});
},
converse
));
},
converse
));
},
converse
));
describe
(
"
The Contacts Roster
"
,
$
.
proxy
(
function
()
{
describe
(
"
Pending Contacts
"
,
$
.
proxy
(
function
()
{
it
(
"
do not have a heading if there aren't any
"
,
$
.
proxy
(
function
()
{
expect
(
this
.
rosterview
.
$el
.
find
(
'
dt#pending-xmpp-contacts
'
).
css
(
'
display
'
)).
toEqual
(
'
none
'
);
...
...
@@ -369,7 +367,6 @@
},
converse
));
describe
(
"
All Contacts
"
,
$
.
proxy
(
function
()
{
it
(
"
are saved to, and can be retrieved from, localStorage
"
,
$
.
proxy
(
function
()
{
var
new_attrs
,
old_attrs
,
attrs
,
old_roster
;
// One contact was declined, so we have 1 less contact then originally
...
...
@@ -555,6 +552,50 @@
},
converse
));
},
converse
));
describe
(
"
A Message Counter
"
,
$
.
proxy
(
function
()
{
it
(
"
is incremented when the message is received and the window is not focused
"
,
$
.
proxy
(
function
()
{
expect
(
this
.
msg_counter
).
toBe
(
0
);
spyOn
(
converse
,
'
incrementMsgCounter
'
).
andCallThrough
();
$
(
window
).
trigger
(
'
blur
'
);
var
message
=
'
This message will increment the message counter
'
;
var
sender_jid
=
cur_names
[
0
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
msg
=
$msg
({
from
:
sender_jid
,
to
:
this
.
connection
.
jid
,
type
:
'
chat
'
,
id
:
(
new
Date
()).
getTime
()
}).
c
(
'
body
'
).
t
(
message
).
up
()
.
c
(
'
active
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
}).
tree
();
this
.
chatboxes
.
messageReceived
(
msg
);
expect
(
converse
.
incrementMsgCounter
).
toHaveBeenCalled
();
expect
(
this
.
msg_counter
).
toBe
(
1
);
},
converse
));
it
(
"
is cleared when the window is focused
"
,
$
.
proxy
(
function
()
{
spyOn
(
converse
,
'
clearMsgCounter
'
).
andCallThrough
();
$
(
window
).
trigger
(
'
focus
'
);
expect
(
converse
.
clearMsgCounter
).
toHaveBeenCalled
();
},
converse
));
it
(
"
is not incremented when the message is received and the window is focused
"
,
$
.
proxy
(
function
()
{
expect
(
this
.
msg_counter
).
toBe
(
0
);
spyOn
(
converse
,
'
incrementMsgCounter
'
).
andCallThrough
();
$
(
window
).
trigger
(
'
focus
'
);
var
message
=
'
This message will not increment the message counter
'
;
var
sender_jid
=
cur_names
[
0
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
msg
=
$msg
({
from
:
sender_jid
,
to
:
this
.
connection
.
jid
,
type
:
'
chat
'
,
id
:
(
new
Date
()).
getTime
()
}).
c
(
'
body
'
).
t
(
message
).
up
()
.
c
(
'
active
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
}).
tree
();
this
.
chatboxes
.
messageReceived
(
msg
);
expect
(
converse
.
incrementMsgCounter
).
not
.
toHaveBeenCalled
();
expect
(
this
.
msg_counter
).
toBe
(
0
);
},
converse
));
},
converse
));
describe
(
"
The Controlbox Tabs
"
,
$
.
proxy
(
function
()
{
beforeEach
(
$
.
proxy
(
function
()
{
// Close any remaining open chatboxes
...
...
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