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
7b8a2441
Commit
7b8a2441
authored
Mar 16, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing bookmarks tests
parent
39e427bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
21 deletions
+22
-21
spec/bookmarks.js
spec/bookmarks.js
+20
-19
src/converse-bookmarks.js
src/converse-bookmarks.js
+1
-1
src/templates/bookmarks_list.html
src/templates/bookmarks_list.html
+1
-1
No files found.
spec/bookmarks.js
View file @
7b8a2441
...
...
@@ -45,7 +45,7 @@
test_utils
.
waitUntil
(
function
()
{
return
!
_
.
isNull
(
view
.
el
.
querySelector
(
'
.toggle-bookmark
'
));
},
300
).
then
(
function
()
{
var
$bookmark
=
$
(
view
.
el
).
find
(
'
.
icon-pushpin
'
);
var
$bookmark
=
$
(
view
.
el
).
find
(
'
.
toggle-bookmark
'
);
$bookmark
[
0
].
click
();
expect
(
view
.
renderBookmarkForm
).
toHaveBeenCalled
();
...
...
@@ -92,7 +92,7 @@
$form
.
find
(
'
input[name="name"]
'
).
val
(
'
Play's the Thing
'
);
$form
.
find
(
'
input[name="autojoin"]
'
).
prop
(
'
checked
'
,
true
);
$form
.
find
(
'
input[name="nick"]
'
).
val
(
'
JC
'
);
view
.
el
.
querySelector
(
'
.b
utto
n-primary
'
).
click
();
view
.
el
.
querySelector
(
'
.b
t
n-primary
'
).
click
();
expect
(
view
.
model
.
get
(
'
bookmarked
'
)).
toBeTruthy
();
expect
(
$bookmark
.
hasClass
(
'
on-button
'
),
true
);
...
...
@@ -188,7 +188,7 @@
test_utils
.
waitUntil
(
function
()
{
return
!
_
.
isNull
(
view
.
el
.
querySelector
(
'
.toggle-bookmark
'
));
},
300
).
then
(
function
()
{
var
bookmark_icon
=
view
.
el
.
querySelector
(
'
.
icon-pushpin
'
);
var
bookmark_icon
=
view
.
el
.
querySelector
(
'
.
toggle-bookmark
'
);
expect
(
_
.
includes
(
bookmark_icon
.
classList
,
'
button-on
'
)).
toBeFalsy
();
view
.
model
.
set
(
'
bookmarked
'
,
true
);
expect
(
_
.
includes
(
bookmark_icon
.
classList
,
'
button-on
'
)).
toBeTruthy
();
...
...
@@ -229,7 +229,7 @@
});
expect
(
_converse
.
bookmarks
.
length
).
toBe
(
1
);
expect
(
view
.
model
.
get
(
'
bookmarked
'
)).
toBeTruthy
();
var
$bookmark_icon
=
$
(
view
.
el
.
querySelector
(
'
.
icon-pushpin
'
));
var
$bookmark_icon
=
$
(
view
.
el
.
querySelector
(
'
.
toggle-bookmark
'
));
expect
(
$bookmark_icon
.
hasClass
(
'
button-on
'
)).
toBeTruthy
();
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
,
errback
)
{
...
...
@@ -463,6 +463,7 @@
[{
'
category
'
:
'
pubsub
'
,
'
type
'
:
'
pep
'
}],
[
'
http://jabber.org/protocol/pubsub#publish-options
'
]
).
then
(
function
()
{
test_utils
.
openControlBox
();
var
IQ_id
;
expect
(
_
.
filter
(
_converse
.
connection
.
send
.
calls
.
all
(),
function
(
call
)
{
...
...
@@ -513,19 +514,18 @@
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
test_utils
.
waitUntil
(
function
()
{
return
$
(
'
#chatrooms d
l.bookmarks dd
'
).
length
;
return
$
(
'
#chatrooms d
iv.bookmarks.rooms-list .room-item
'
).
length
;
},
300
).
then
(
function
()
{
expect
(
$
(
'
#chatrooms d
l.bookmarks dd
'
).
length
).
toBe
(
4
);
expect
(
$
(
'
#chatrooms d
l.bookmarks dd
a
'
).
text
().
trim
()).
toBe
(
"
1st Bookmark Another room Bookmark with a very very long name that will be shortened The Play
'
s the Thing
"
)
expect
(
$
(
'
#chatrooms d
iv.bookmarks.rooms-list .room-item
'
).
length
).
toBe
(
4
);
expect
(
$
(
'
#chatrooms d
iv.bookmarks.rooms-list .room-item
a
'
).
text
().
trim
()).
toBe
(
"
1st Bookmark Another room Bookmark with a very very long name that will be shortened The Play
'
s the Thing
"
)
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
$
(
'
#chatrooms
dl.bookmarks dd
:nth-child(2) a:nth-child(2)
'
)[
0
].
click
();
$
(
'
#chatrooms
.bookmarks.rooms-list .room-item
:nth-child(2) a:nth-child(2)
'
)[
0
].
click
();
expect
(
window
.
confirm
).
toHaveBeenCalled
();
return
test_utils
.
waitUntil
(
function
()
{
return
$
(
'
#chatrooms
dl.bookmarks dd
a
'
).
text
().
trim
()
===
"
1st Bookmark Bookmark with a very very long name that will be shortened The Play
'
s the Thing
"
;
return
$
(
'
#chatrooms
.bookmarks.rooms-list .room-item
a
'
).
text
().
trim
()
===
"
1st Bookmark Bookmark with a very very long name that will be shortened The Play
'
s the Thing
"
;
},
300
)
}).
then
(
done
);
});
...
...
@@ -534,6 +534,8 @@
it
(
"
remembers the toggle state of the bookmarks list
"
,
mock
.
initConverseWithPromises
(
[
'
send
'
],
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
test_utils
.
openControlBox
();
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
bare_jid
,
[{
'
category
'
:
'
pubsub
'
,
'
type
'
:
'
pep
'
}],
...
...
@@ -573,19 +575,18 @@
'
name
'
:
'
The Play
'
,
'
nick
'
:
''
});
test_utils
.
waitUntil
(
function
()
{
return
$
(
'
#chatrooms
dl.bookmarks dd
:visible
'
).
length
;
return
$
(
'
#chatrooms
.bookmarks.rooms-list .room-item
:visible
'
).
length
;
},
300
).
then
(
function
()
{
expect
(
$
(
'
#chatrooms
dl.bookmarks
'
).
hasClass
(
'
collapsed
'
)).
toBeFalsy
();
expect
(
$
(
'
#chatrooms
dl.bookmarks dd
:visible
'
).
length
).
toBe
(
1
);
expect
(
$
(
'
#chatrooms
.bookmarks.rooms-list
'
).
hasClass
(
'
collapsed
'
)).
toBeFalsy
();
expect
(
$
(
'
#chatrooms
.bookmarks.rooms-list .room-item
:visible
'
).
length
).
toBe
(
1
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
OPENED
);
$
(
'
#chatrooms .bookmarks-toggle
'
)[
0
].
click
();
expect
(
$
(
'
#chatrooms
dl.bookmarks
'
).
hasClass
(
'
collapsed
'
)).
toBeTruthy
();
expect
(
$
(
'
#chatrooms
.bookmarks.rooms-list
'
).
hasClass
(
'
collapsed
'
)).
toBeTruthy
();
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
CLOSED
);
$
(
'
#chatrooms .bookmarks-toggle
'
)[
0
].
click
();
expect
(
$
(
'
#chatrooms
dl.bookmarks
'
).
hasClass
(
'
collapsed
'
)).
toBeFalsy
();
expect
(
$
(
'
#chatrooms
dl.bookmarks dd
:visible
'
).
length
).
toBe
(
1
);
expect
(
$
(
'
#chatrooms
.bookmarks.rooms-list
'
).
hasClass
(
'
collapsed
'
)).
toBeFalsy
();
expect
(
$
(
'
#chatrooms
.bookmarks.rooms-list .room-item
:visible
'
).
length
).
toBe
(
1
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
OPENED
);
done
();
});
...
...
src/converse-bookmarks.js
View file @
7b8a2441
...
...
@@ -427,7 +427,7 @@
'
info_remove_bookmark
'
:
__
(
'
Unbookmark this room
'
),
'
info_title
'
:
__
(
'
Show more information on this room
'
),
'
jid
'
:
this
.
model
.
get
(
'
jid
'
),
'
name
'
:
this
.
model
.
get
(
'
name
'
),
'
name
'
:
Strophe
.
xmlunescape
(
this
.
model
.
get
(
'
name
'
)
),
'
open_title
'
:
__
(
'
Click to open this room
'
)
});
}
...
...
src/templates/bookmarks_list.html
View file @
7b8a2441
<a
href=
"#"
class=
"rooms-toggle bookmarks-toggle icon-{{{o.toggle_state}}}"
title=
"{{{o.desc_bookmarks}}}"
>
{{{o.label_bookmarks}}}
</a>
<d
l
class=
"bookmarks rooms-list {[ if (o.toggle_state !== o._converse.OPENED) { ]} hidden {[ } ]}"
></dl
>
<d
iv
class=
"bookmarks rooms-list {[ if (o.toggle_state !== o._converse.OPENED) { ]} hidden {[ } ]}"
></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