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
9cc2f233
Commit
9cc2f233
authored
Apr 17, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use fewer contacts to make visual output clearer
parent
b1ecdfda
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
23 deletions
+16
-23
spec/MainSpec.js
spec/MainSpec.js
+15
-22
tests_main.js
tests_main.js
+1
-1
No files found.
spec/MainSpec.js
View file @
9cc2f233
...
@@ -10,22 +10,15 @@
...
@@ -10,22 +10,15 @@
return
describe
(
"
Converse.js
"
,
$
.
proxy
(
function
()
{
return
describe
(
"
Converse.js
"
,
$
.
proxy
(
function
()
{
// Names from http://www.fakenamegenerator.com/
// Names from http://www.fakenamegenerator.com/
var
req_names
=
[
var
req_names
=
[
'
Louw Spekman
'
,
'
Mohamad Stet
'
,
'
Dominik Beyer
'
,
'
Dirk Eichel
'
,
'
Marco Duerr
'
,
'
Ute Schiffer
'
,
'
Louw Spekman
'
,
'
Mohamad Stet
'
,
'
Dominik Beyer
'
'
Billie Westerhuis
'
,
'
Sarah Kuester
'
,
'
Sabrina Loewe
'
,
'
Laura Duerr
'
,
'
Mathias Meyer
'
,
'
Tijm Keller
'
,
'
Lea Gerste
'
,
'
Martin Pfeffer
'
,
'
Ulrike Abt
'
,
'
Zoubida van Rooij
'
,
'
Maylin Hettema
'
,
'
Ruwan Bechan
'
,
'
Marco Beich
'
,
'
Karin Busch
'
,
'
Mathias Müller
'
];
];
var
pend_names
=
[
var
pend_names
=
[
'
Suleyman van Beusichem
'
,
'
Nicole Diederich
'
,
'
Nanja van Yperen
'
,
'
Delany Bloemendaal
'
,
'
Suleyman van Beusichem
'
,
'
Nicole Diederich
'
,
'
Nanja van Yperen
'
'
Jannah Hofmeester
'
,
'
Christine Trommler
'
,
'
Martin Bumgarner
'
,
'
Emil Baeten
'
,
'
Farshad Brasser
'
,
'
Gabriele Fisher
'
,
'
Sofiane Schopman
'
,
'
Sky Wismans
'
,
'
Jeffery Stoelwinder
'
,
'
Ganesh Waaijenberg
'
,
'
Dani Boldewijn
'
,
'
Katrin Propst
'
,
'
Martina Kaiser
'
,
'
Philipp Kappel
'
,
'
Meeke Grootendorst
'
];
];
var
cur_names
=
[
var
cur_names
=
[
'
Max Frankfurter
'
,
'
Candice van der Knijff
'
,
'
Irini Vlastuin
'
,
'
Rinse Sommer
'
,
'
Annegreet Gomez
'
,
'
Max Frankfurter
'
,
'
Candice van der Knijff
'
,
'
Irini Vlastuin
'
,
'
Rinse Sommer
'
,
'
Annegreet Gomez
'
,
'
Robin Schook
'
,
'
Marcel Eberhardt
'
,
'
Simone Brauer
'
,
'
Asmaa Haakman
'
,
'
Felix Amsel
'
,
'
Robin Schook
'
,
'
Marcel Eberhardt
'
,
'
Simone Brauer
'
,
'
Asmaa Haakman
'
,
'
Felix Amsel
'
,
'
Lena Grunewald
'
,
'
Laura Grunewald
'
,
'
Mandy Seiler
'
,
'
Sven Bosch
'
,
'
Nuriye Cuypers
'
,
'
Ben Zomer
'
,
'
Lena Grunewald
'
,
'
Laura Grunewald
'
,
'
Mandy Seiler
'
,
'
Sven Bosch
'
,
'
Nuriye Cuypers
'
'
Leah Weiss
'
,
'
Francesca Disseldorp
'
,
'
Sven Bumgarner
'
,
'
Benjamin Zweig
'
];
];
var
num_contacts
=
req_names
.
length
+
pend_names
.
length
+
cur_names
.
length
;
var
num_contacts
=
req_names
.
length
+
pend_names
.
length
+
cur_names
.
length
;
this
.
bare_jid
=
'
dummy@localhost
'
;
this
.
bare_jid
=
'
dummy@localhost
'
;
...
@@ -148,7 +141,7 @@
...
@@ -148,7 +141,7 @@
it
(
"
can change their status to online and be sorted alphabetically
"
,
$
.
proxy
(
function
()
{
it
(
"
can change their status to online and be sorted alphabetically
"
,
$
.
proxy
(
function
()
{
var
item
,
view
,
jid
,
t
;
var
item
,
view
,
jid
,
t
;
spyOn
(
this
.
rosterview
,
'
render
'
).
andCallThrough
();
spyOn
(
this
.
rosterview
,
'
render
'
).
andCallThrough
();
for
(
i
=
0
;
i
<
5
;
i
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
jid
=
cur_names
[
i
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
jid
=
cur_names
[
i
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
view
=
this
.
rosterview
.
rosteritemviews
[
jid
];
view
=
this
.
rosterview
.
rosteritemviews
[
jid
];
spyOn
(
view
,
'
render
'
).
andCallThrough
();
spyOn
(
view
,
'
render
'
).
andCallThrough
();
...
@@ -166,7 +159,7 @@
...
@@ -166,7 +159,7 @@
it
(
"
can change their status to busy and be sorted alphabetically
"
,
$
.
proxy
(
function
()
{
it
(
"
can change their status to busy and be sorted alphabetically
"
,
$
.
proxy
(
function
()
{
var
item
,
view
,
jid
,
t
;
var
item
,
view
,
jid
,
t
;
spyOn
(
this
.
rosterview
,
'
render
'
).
andCallThrough
();
spyOn
(
this
.
rosterview
,
'
render
'
).
andCallThrough
();
for
(
i
=
5
;
i
<
10
;
i
++
)
{
for
(
i
=
3
;
i
<
6
;
i
++
)
{
jid
=
cur_names
[
i
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
jid
=
cur_names
[
i
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
view
=
this
.
rosterview
.
rosteritemviews
[
jid
];
view
=
this
.
rosterview
.
rosteritemviews
[
jid
];
spyOn
(
view
,
'
render
'
).
andCallThrough
();
spyOn
(
view
,
'
render
'
).
andCallThrough
();
...
@@ -176,14 +169,14 @@
...
@@ -176,14 +169,14 @@
expect
(
this
.
rosterview
.
render
).
toHaveBeenCalled
();
expect
(
this
.
rosterview
.
render
).
toHaveBeenCalled
();
// Check that they are sorted alphabetically
// Check that they are sorted alphabetically
t
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contacts
'
).
siblings
(
'
dd.current-xmpp-contact.dnd
'
).
find
(
'
a.open-chat
'
).
text
();
t
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contacts
'
).
siblings
(
'
dd.current-xmpp-contact.dnd
'
).
find
(
'
a.open-chat
'
).
text
();
expect
(
t
).
toEqual
(
cur_names
.
slice
(
5
,
i
+
1
).
sort
().
join
(
''
));
expect
(
t
).
toEqual
(
cur_names
.
slice
(
3
,
i
+
1
).
sort
().
join
(
''
));
}
}
},
xmppchat
));
},
xmppchat
));
it
(
"
can change their status to away and be sorted alphabetically
"
,
$
.
proxy
(
function
()
{
it
(
"
can change their status to away and be sorted alphabetically
"
,
$
.
proxy
(
function
()
{
var
item
,
view
,
jid
,
t
;
var
item
,
view
,
jid
,
t
;
spyOn
(
this
.
rosterview
,
'
render
'
).
andCallThrough
();
spyOn
(
this
.
rosterview
,
'
render
'
).
andCallThrough
();
for
(
i
=
10
;
i
<
15
;
i
++
)
{
for
(
i
=
6
;
i
<
9
;
i
++
)
{
jid
=
cur_names
[
i
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
jid
=
cur_names
[
i
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
view
=
this
.
rosterview
.
rosteritemviews
[
jid
];
view
=
this
.
rosterview
.
rosteritemviews
[
jid
];
spyOn
(
view
,
'
render
'
).
andCallThrough
();
spyOn
(
view
,
'
render
'
).
andCallThrough
();
...
@@ -194,14 +187,14 @@
...
@@ -194,14 +187,14 @@
// Check that they are sorted alphabetically
// Check that they are sorted alphabetically
t
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contacts
'
).
siblings
(
'
dd.current-xmpp-contact.away
'
).
find
(
'
a.open-chat
'
).
text
();
t
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contacts
'
).
siblings
(
'
dd.current-xmpp-contact.away
'
).
find
(
'
a.open-chat
'
).
text
();
expect
(
t
).
toEqual
(
cur_names
.
slice
(
10
,
i
+
1
).
sort
().
join
(
''
));
expect
(
t
).
toEqual
(
cur_names
.
slice
(
6
,
i
+
1
).
sort
().
join
(
''
));
}
}
},
xmppchat
));
},
xmppchat
));
it
(
"
can change their status to unavailable and be sorted alphabetically
"
,
$
.
proxy
(
function
()
{
it
(
"
can change their status to unavailable and be sorted alphabetically
"
,
$
.
proxy
(
function
()
{
var
item
,
view
,
jid
,
t
;
var
item
,
view
,
jid
,
t
;
spyOn
(
this
.
rosterview
,
'
render
'
).
andCallThrough
();
spyOn
(
this
.
rosterview
,
'
render
'
).
andCallThrough
();
for
(
i
=
15
;
i
<
20
;
i
++
)
{
for
(
i
=
9
;
i
<
12
;
i
++
)
{
jid
=
cur_names
[
i
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
jid
=
cur_names
[
i
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
view
=
this
.
rosterview
.
rosteritemviews
[
jid
];
view
=
this
.
rosterview
.
rosteritemviews
[
jid
];
spyOn
(
view
,
'
render
'
).
andCallThrough
();
spyOn
(
view
,
'
render
'
).
andCallThrough
();
...
@@ -212,7 +205,7 @@
...
@@ -212,7 +205,7 @@
// Check that they are sorted alphabetically
// Check that they are sorted alphabetically
t
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contacts
'
).
siblings
(
'
dd.current-xmpp-contact.unavailable
'
).
find
(
'
a.open-chat
'
).
text
();
t
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contacts
'
).
siblings
(
'
dd.current-xmpp-contact.unavailable
'
).
find
(
'
a.open-chat
'
).
text
();
expect
(
t
).
toEqual
(
cur_names
.
slice
(
15
,
i
+
1
).
sort
().
join
(
''
));
expect
(
t
).
toEqual
(
cur_names
.
slice
(
9
,
i
+
1
).
sort
().
join
(
''
));
}
}
},
xmppchat
));
},
xmppchat
));
...
@@ -220,23 +213,23 @@
...
@@ -220,23 +213,23 @@
var
contacts
=
this
.
rosterview
.
$el
.
find
(
'
dd.current-xmpp-contact
'
);
var
contacts
=
this
.
rosterview
.
$el
.
find
(
'
dd.current-xmpp-contact
'
);
var
i
;
var
i
;
// The first five contacts are online.
// The first five contacts are online.
for
(
i
=
0
;
i
<
5
;
i
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
expect
(
$
(
contacts
[
i
]).
attr
(
'
class
'
).
split
(
'
'
,
1
)[
0
]).
toEqual
(
'
online
'
);
expect
(
$
(
contacts
[
i
]).
attr
(
'
class
'
).
split
(
'
'
,
1
)[
0
]).
toEqual
(
'
online
'
);
}
}
// The next five are busy
// The next five are busy
for
(
i
=
5
;
i
<
10
;
i
++
)
{
for
(
i
=
3
;
i
<
6
;
i
++
)
{
expect
(
$
(
contacts
[
i
]).
attr
(
'
class
'
).
split
(
'
'
,
1
)[
0
]).
toEqual
(
'
dnd
'
);
expect
(
$
(
contacts
[
i
]).
attr
(
'
class
'
).
split
(
'
'
,
1
)[
0
]).
toEqual
(
'
dnd
'
);
}
}
// The next five are away
// The next five are away
for
(
i
=
10
;
i
<
15
;
i
++
)
{
for
(
i
=
6
;
i
<
9
;
i
++
)
{
expect
(
$
(
contacts
[
i
]).
attr
(
'
class
'
).
split
(
'
'
,
1
)[
0
]).
toEqual
(
'
away
'
);
expect
(
$
(
contacts
[
i
]).
attr
(
'
class
'
).
split
(
'
'
,
1
)[
0
]).
toEqual
(
'
away
'
);
}
}
// The next five are unavailable
// The next five are unavailable
for
(
i
=
15
;
i
<
20
;
i
++
)
{
for
(
i
=
9
;
i
<
12
;
i
++
)
{
expect
(
$
(
contacts
[
i
]).
attr
(
'
class
'
).
split
(
'
'
,
1
)[
0
]).
toEqual
(
'
unavailable
'
);
expect
(
$
(
contacts
[
i
]).
attr
(
'
class
'
).
split
(
'
'
,
1
)[
0
]).
toEqual
(
'
unavailable
'
);
}
}
// The next 20 are offline
// The next 20 are offline
for
(
i
=
20
;
i
<
cur_names
.
length
;
i
++
)
{
for
(
i
=
12
;
i
<
cur_names
.
length
;
i
++
)
{
expect
(
$
(
contacts
[
i
]).
attr
(
'
class
'
).
split
(
'
'
,
1
)[
0
]).
toEqual
(
'
offline
'
);
expect
(
$
(
contacts
[
i
]).
attr
(
'
class
'
).
split
(
'
'
,
1
)[
0
]).
toEqual
(
'
offline
'
);
}
}
},
xmppchat
));
},
xmppchat
));
...
...
tests_main.js
View file @
9cc2f233
...
@@ -2,7 +2,7 @@ require(["jquery", "spec/MainSpec"], function($) {
...
@@ -2,7 +2,7 @@ require(["jquery", "spec/MainSpec"], function($) {
$
(
function
(
$
)
{
$
(
function
(
$
)
{
var
jasmineEnv
=
jasmine
.
getEnv
();
var
jasmineEnv
=
jasmine
.
getEnv
();
jasmineEnv
.
updateInterval
=
10
00
;
jasmineEnv
.
updateInterval
=
5
00
;
var
htmlReporter
=
new
jasmine
.
HtmlReporter
();
var
htmlReporter
=
new
jasmine
.
HtmlReporter
();
...
...
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