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
d0f07f26
Commit
d0f07f26
authored
Jul 31, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check that users are sorted per group and that groups are in the correct order.
updates #83
parent
e1ee8333
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
15 deletions
+35
-15
converse.js
converse.js
+12
-12
spec/controlbox.js
spec/controlbox.js
+23
-3
No files found.
converse.js
View file @
d0f07f26
...
...
@@ -3354,7 +3354,7 @@
return
this
;
},
getRoster
Element
:
function
()
{
getRoster
:
function
()
{
// TODO: see is _ensureElement can be used.
// Return the document fragment if it exists.
var
$el
;
...
...
@@ -3366,7 +3366,8 @@
},
getGroup
:
function
(
name
)
{
var
groups
,
$groups
,
group_lower
,
index
;
var
groups
,
$groups
,
group_lower
,
index
,
$el
=
this
.
getRoster
();
var
$group
=
$el
.
find
(
'
.roster-group[data-group="
'
+
name
+
'
"]
'
);
if
(
$group
.
length
>
0
)
{
return
$group
;
...
...
@@ -3379,7 +3380,7 @@
}));
if
(
$groups
.
length
)
{
group_lower
=
name
.
toLowerCase
();
groups
=
$
.
map
(
$groups
,
function
(
o
)
{
return
o
.
dataset
.
name
.
toLowerCase
();
})
groups
=
$
.
map
(
$groups
,
function
(
o
)
{
return
o
.
dataset
.
group
.
toLowerCase
();
})
groups
.
push
(
group_lower
);
index
=
groups
.
sort
().
indexOf
(
group_lower
);
if
(
index
==
0
)
{
...
...
@@ -3392,24 +3393,23 @@
}
else
{
// This shouldn't actually happen, since
// there's always the Ungrouped.
this
.
getRoster
Element
().
append
(
$group
);
this
.
getRoster
().
append
(
$group
);
}
return
$group
;
},
addCurrentContact
:
function
(
view
)
{
var
$el
=
this
.
getRosterElement
(),
item
=
view
.
model
;
var
item
=
view
.
model
;
if
(
converse
.
roster_groups
)
{
if
(
item
.
get
(
'
groups
'
).
length
===
0
)
{
$el
.
find
(
'
.roster-group[data-group="
'
+
HEADER_UNGROUPED
+
'
"]
'
).
after
(
view
.
el
);
this
.
getRoster
()
.
find
(
'
.roster-group[data-group="
'
+
HEADER_UNGROUPED
+
'
"]
'
).
after
(
view
.
el
);
}
else
{
_
.
each
(
item
.
get
(
'
groups
'
),
$
.
proxy
(
function
(
group
)
{
this
.
getGroup
(
group
).
after
(
view
.
el
);
},
this
));
}
}
else
{
$el
.
find
(
'
.roster-group[data-group="
'
+
HEADER_CURRENT_CONTACTS
+
'
"]
'
).
after
(
view
.
el
);
this
.
getRoster
()
.
find
(
'
.roster-group[data-group="
'
+
HEADER_CURRENT_CONTACTS
+
'
"]
'
).
after
(
view
.
el
);
}
},
...
...
@@ -3423,9 +3423,9 @@
if
(
view
.
$el
.
hasClass
(
'
current-xmpp-contact
'
))
{
this
.
addCurrentContact
(
view
);
}
else
if
(
view
.
$el
.
hasClass
(
'
pending-xmpp-contact
'
))
{
this
.
getRoster
Element
().
find
(
'
#pending-xmpp-contacts
'
).
after
(
view
.
el
);
this
.
getRoster
().
find
(
'
#pending-xmpp-contacts
'
).
after
(
view
.
el
);
}
else
if
(
view
.
$el
.
hasClass
(
'
requesting-xmpp-contact
'
))
{
this
.
getRoster
Element
().
find
(
'
#xmpp-contact-requests
'
).
after
(
view
.
render
().
el
);
this
.
getRoster
().
find
(
'
#xmpp-contact-requests
'
).
after
(
view
.
render
().
el
);
}
return
this
;
},
...
...
@@ -3440,7 +3440,7 @@
},
toggleHeaders
:
function
()
{
var
$el
=
this
.
getRoster
Element
();
var
$el
=
this
.
getRoster
();
var
$contact_requests
=
$el
.
find
(
'
#xmpp-contact-requests
'
),
$pending_contacts
=
$el
.
find
(
'
#pending-xmpp-contacts
'
);
var
$groups
=
$el
.
find
(
'
.roster-group
'
);
...
...
@@ -3493,7 +3493,7 @@
* 1). See if the jquery detach method can be somehow used to avoid DOM reflows.
* 2). Likewise see if documentFragment can be used.
*/
var
$el
=
this
.
getRoster
Element
();
var
$el
=
this
.
getRoster
();
$el
.
find
(
'
.roster-group
'
).
each
(
$
.
proxy
(
function
(
idx
,
group
)
{
var
$group
=
$
(
group
);
var
$contacts
=
$group
.
nextUntil
(
'
dt
'
,
'
dd.current-xmpp-contact
'
);
...
...
spec/controlbox.js
View file @
d0f07f26
...
...
@@ -142,6 +142,9 @@
spyOn
(
this
.
rosterview
,
'
updateCount
'
).
andCallThrough
();
converse
.
roster_groups
=
true
;
converse
.
rosterview
.
render
();
utils
.
createContacts
(
'
pending
'
);
utils
.
createContacts
(
'
requesting
'
);
var
groups
=
{
'
colleagues
'
:
3
,
'
friends & acquaintences
'
:
3
,
...
...
@@ -162,9 +165,26 @@
});
}
},
converse
));
// Check that the groups appear alphabetically
t
=
this
.
rosterview
.
$el
.
find
(
'
dt.roster-group a.group-toggle
'
).
text
();
expect
(
t
).
toEqual
(
'
colleaguesFamilyfriends & acquaintencesUngrouped
'
);
// Check that the groups appear alphabetically and that
// requesting and pending contacts are last.
var
group_titles
=
$
.
map
(
this
.
rosterview
.
$el
.
find
(
'
dt
'
),
function
(
o
)
{
return
$
(
o
).
text
().
trim
();
});
expect
(
group_titles
).
toEqual
([
"
colleagues
"
,
"
Family
"
,
"
friends & acquaintences
"
,
"
Ungrouped
"
,
"
Contact requests
"
,
"
Pending contacts
"
]);
// Check that usernames appear alphabetically per group
_
.
each
(
_
.
keys
(
groups
),
$
.
proxy
(
function
(
name
)
{
var
$contacts
=
this
.
rosterview
.
$
(
'
dt.roster-group[data-group="
'
+
name
+
'
"]
'
).
nextUntil
(
'
dt
'
,
'
dd
'
);
var
names
=
$
.
map
(
$contacts
,
function
(
o
)
{
return
$
(
o
).
text
().
trim
();
});
expect
(
names
).
toEqual
(
_
.
clone
(
names
).
sort
());
},
converse
));
// Check that pending and requesting contacts appear after
// current contacts.
},
converse
));
},
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