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
d50992b1
Commit
d50992b1
authored
May 09, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bookmarks: Fix remaining broken tests.
parent
07dbf14a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
12 deletions
+59
-12
spec/bookmarks.js
spec/bookmarks.js
+56
-10
src/converse-core.js
src/converse-core.js
+3
-2
No files found.
spec/bookmarks.js
View file @
d50992b1
...
...
@@ -309,11 +309,14 @@
if
(
!
(
stanza
instanceof
Element
)
||
stanza
.
nodeName
!==
'
iq
'
)
{
return
;
}
if
(
stanza
.
outerHTML
===
// XXX: Wrapping in a div is a workaround for PhantomJS
var
div
=
document
.
createElement
(
'
div
'
);
div
.
appendChild
(
stanza
);
if
(
div
.
innerHTML
===
'
<iq from="dummy@localhost/resource" type="get"
'
+
'
xmlns="jabber:client" id="
'
+
stanza
.
getAttribute
(
'
id
'
)
+
'
">
'
+
'
<pubsub xmlns="http://jabber.org/protocol/pubsub">
'
+
'
<items node="storage:bookmarks"
/
>
'
+
'
<items node="storage:bookmarks"
></items
>
'
+
'
</pubsub>
'
+
'
</iq>
'
)
{
IQ_id
=
stanza
.
getAttribute
(
'
id
'
);
...
...
@@ -366,14 +369,29 @@
describe
(
"
The rooms panel
"
,
function
()
{
it
(
"
shows a list of bookmarks
"
,
mock
.
initConverse
(
function
(
_converse
)
{
it
(
"
shows a list of bookmarks
"
,
mock
.
initConverse
WithConnectionSpies
([
'
send
'
],
function
(
_converse
)
{
var
IQ_id
;
var
sendIQ
=
_converse
.
connection
.
sendIQ
;
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
,
errback
)
{
IQ_id
=
sendIQ
.
bind
(
this
)(
iq
,
callback
,
errback
);
});
expect
(
_
.
filter
(
_converse
.
connection
.
send
.
calls
.
all
(),
function
(
call
)
{
var
stanza
=
call
.
args
[
0
]
if
(
!
(
stanza
instanceof
Element
)
||
stanza
.
nodeName
!==
'
iq
'
)
{
return
;
}
// XXX: Wrapping in a div is a workaround for PhantomJS
var
div
=
document
.
createElement
(
'
div
'
);
div
.
appendChild
(
stanza
);
if
(
div
.
innerHTML
===
'
<iq from="dummy@localhost/resource" type="get"
'
+
'
xmlns="jabber:client" id="
'
+
stanza
.
getAttribute
(
'
id
'
)
+
'
">
'
+
'
<pubsub xmlns="http://jabber.org/protocol/pubsub">
'
+
'
<items node="storage:bookmarks"></items>
'
+
'
</pubsub>
'
+
'
</iq>
'
)
{
IQ_id
=
stanza
.
getAttribute
(
'
id
'
);
return
true
;
}
}).
length
).
toBe
(
1
);
_converse
.
chatboxviews
.
get
(
'
controlbox
'
).
$
(
'
#chatrooms dl.bookmarks
'
).
html
(
''
);
_converse
.
emit
(
'
chatBoxesFetched
'
);
var
stanza
=
$iq
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
result
'
,
'
id
'
:
IQ_id
})
.
c
(
'
pubsub
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
PUBSUB
})
.
c
(
'
items
'
,
{
'
node
'
:
'
storage:bookmarks
'
})
...
...
@@ -398,14 +416,42 @@
expect
(
$
(
'
#chatrooms dl.bookmarks dd
'
).
length
).
toBe
(
3
);
}));
it
(
"
remembers the toggle state of the bookmarks list
"
,
mock
.
initConverse
(
function
(
_converse
)
{
it
(
"
remembers the toggle state of the bookmarks list
"
,
mock
.
initConverseWithConnectionSpies
([
'
send
'
],
function
(
_converse
)
{
var
IQ_id
;
expect
(
_
.
filter
(
_converse
.
connection
.
send
.
calls
.
all
(),
function
(
call
)
{
var
stanza
=
call
.
args
[
0
]
if
(
!
(
stanza
instanceof
Element
)
||
stanza
.
nodeName
!==
'
iq
'
)
{
return
;
}
// XXX: Wrapping in a div is a workaround for PhantomJS
var
div
=
document
.
createElement
(
'
div
'
);
div
.
appendChild
(
stanza
);
if
(
div
.
innerHTML
===
'
<iq from="dummy@localhost/resource" type="get"
'
+
'
xmlns="jabber:client" id="
'
+
stanza
.
getAttribute
(
'
id
'
)
+
'
">
'
+
'
<pubsub xmlns="http://jabber.org/protocol/pubsub">
'
+
'
<items node="storage:bookmarks"></items>
'
+
'
</pubsub>
'
+
'
</iq>
'
)
{
IQ_id
=
stanza
.
getAttribute
(
'
id
'
);
return
true
;
}
}).
length
).
toBe
(
1
);
_converse
.
chatboxviews
.
get
(
'
controlbox
'
).
$
(
'
#chatrooms dl.bookmarks
'
).
html
(
''
);
var
stanza
=
$iq
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
result
'
,
'
id
'
:
IQ_id
})
.
c
(
'
pubsub
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
PUBSUB
})
.
c
(
'
items
'
,
{
'
node
'
:
'
storage:bookmarks
'
})
.
c
(
'
item
'
,
{
'
id
'
:
'
current
'
})
.
c
(
'
storage
'
,
{
'
xmlns
'
:
'
storage:bookmarks
'
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
bookmarks
.
create
({
'
jid
'
:
'
theplay@conference.shakespeare.lit
'
,
'
autojoin
'
:
false
,
'
name
'
:
'
The Play
'
,
'
nick
'
:
''
});
_converse
.
emit
(
'
chatBoxesFetched
'
);
test_utils
.
openControlBox
().
openRoomsPanel
(
_converse
);
expect
(
$
(
'
#chatrooms dl.bookmarks dd:visible
'
).
length
).
toBe
(
1
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
OPENED
);
...
...
src/converse-core.js
View file @
d50992b1
...
...
@@ -38,8 +38,9 @@
* config of requirejs-tpl in main.js). This one is for normal inline templates.
*/
_
.
templateSettings
=
{
evaluate
:
/
\{\[([\s\S]
+
?)\]\}
/g
,
interpolate
:
/
\{\{([\s\S]
+
?)\}\}
/g
'
escape
'
:
/
\
{
\
{
\
{([
\
s
\
S
]
+
?)
\
}
\
}
\
}
/g
,
'
evaluate
'
:
/
\{\[([\s\S]
+
?)\]\}
/g
,
'
interpolate
'
:
/
\
{
\
{([
\
s
\
S
]
+
?)
\
}
\
}
/
g
};
var
_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