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
cc98cea0
Commit
cc98cea0
authored
Jun 30, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing tests by waiting appropriately
parent
9a60b5bb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
158 additions
and
151 deletions
+158
-151
dist/converse.js
dist/converse.js
+1
-1
spec/bookmarks.js
spec/bookmarks.js
+33
-29
spec/chatroom.js
spec/chatroom.js
+122
-120
src/converse-muc.js
src/converse-muc.js
+2
-1
No files found.
dist/converse.js
View file @
cc98cea0
...
@@ -78646,7 +78646,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -78646,7 +78646,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
if (_converse.allow_muc_invitations) {
if (_converse.allow_muc_invitations) {
const registerDirectInvitationHandler = function registerDirectInvitationHandler() {
const registerDirectInvitationHandler = function registerDirectInvitationHandler() {
_converse.connection.addHandler(
function (message)
{
_converse.connection.addHandler(
message =>
{
_converse.onDirectMUCInvitation(message);
_converse.onDirectMUCInvitation(message);
return true;
return true;
spec/bookmarks.js
View file @
cc98cea0
...
@@ -428,6 +428,8 @@
...
@@ -428,6 +428,8 @@
* </iq>
* </iq>
*/
*/
expect
(
_converse
.
bookmarks
.
models
.
length
).
toBe
(
0
);
expect
(
_converse
.
bookmarks
.
models
.
length
).
toBe
(
0
);
spyOn
(
_converse
.
bookmarks
,
'
onBookmarksReceived
'
).
and
.
callThrough
();
var
stanza
=
$iq
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
result
'
,
'
id
'
:
IQ_id
})
var
stanza
=
$iq
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
result
'
,
'
id
'
:
IQ_id
})
.
c
(
'
pubsub
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
PUBSUB
})
.
c
(
'
pubsub
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
PUBSUB
})
.
c
(
'
items
'
,
{
'
node
'
:
'
storage:bookmarks
'
})
.
c
(
'
items
'
,
{
'
node
'
:
'
storage:bookmarks
'
})
...
@@ -444,11 +446,13 @@
...
@@ -444,11 +446,13 @@
'
jid
'
:
'
another@conference.shakespeare.lit
'
'
jid
'
:
'
another@conference.shakespeare.lit
'
});
// Purposefully exclude the <nick> element to test #1043
});
// Purposefully exclude the <nick> element to test #1043
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
return
test_utils
.
waitUntil
(()
=>
_converse
.
bookmarks
.
onBookmarksReceived
.
calls
.
count
(),
300
)
}).
then
(()
=>
{
expect
(
_converse
.
bookmarks
.
models
.
length
).
toBe
(
2
);
expect
(
_converse
.
bookmarks
.
models
.
length
).
toBe
(
2
);
expect
(
_converse
.
bookmarks
.
findWhere
({
'
jid
'
:
'
theplay@conference.shakespeare.lit
'
}).
get
(
'
autojoin
'
)).
toBe
(
true
);
expect
(
_converse
.
bookmarks
.
findWhere
({
'
jid
'
:
'
theplay@conference.shakespeare.lit
'
}).
get
(
'
autojoin
'
)).
toBe
(
true
);
expect
(
_converse
.
bookmarks
.
findWhere
({
'
jid
'
:
'
another@conference.shakespeare.lit
'
}).
get
(
'
autojoin
'
)).
toBe
(
false
);
expect
(
_converse
.
bookmarks
.
findWhere
({
'
jid
'
:
'
another@conference.shakespeare.lit
'
}).
get
(
'
autojoin
'
)).
toBe
(
false
);
done
();
done
();
});
})
.
catch
(
_
.
partial
(
console
.
error
,
_
))
;
}));
}));
describe
(
"
The rooms panel
"
,
function
()
{
describe
(
"
The rooms panel
"
,
function
()
{
...
...
spec/chatroom.js
View file @
cc98cea0
...
@@ -1800,6 +1800,8 @@
...
@@ -1800,6 +1800,8 @@
"
<query xmlns='http://jabber.org/protocol/disco#info'/>
"
+
"
<query xmlns='http://jabber.org/protocol/disco#info'/>
"
+
"
</iq>
"
);
"
</iq>
"
);
var
view
=
_converse
.
chatboxviews
.
get
(
'
coven@chat.shakespeare.lit
'
);
spyOn
(
view
.
model
,
'
parseRoomFeatures
'
).
and
.
callThrough
();
/* <iq from='coven@chat.shakespeare.lit'
/* <iq from='coven@chat.shakespeare.lit'
* id='ik3vs715'
* id='ik3vs715'
* to='hag66@shakespeare.lit/pda'
* to='hag66@shakespeare.lit/pda'
...
@@ -1839,8 +1841,8 @@
...
@@ -1839,8 +1841,8 @@
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_unmoderated
'
}).
up
()
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_unmoderated
'
}).
up
()
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_nonanonymous
'
});
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_nonanonymous
'
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
features_stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
features_stanza
));
test_utils
.
waitUntil
(()
=>
view
.
model
.
parseRoomFeatures
.
calls
.
count
(),
300
)
var
view
=
_converse
.
chatboxviews
.
get
(
'
coven@chat.shakespeare.lit
'
);
.
then
(()
=>
{
expect
(
view
.
model
.
get
(
'
features_fetched
'
)).
toBeTruthy
();
expect
(
view
.
model
.
get
(
'
features_fetched
'
)).
toBeTruthy
();
expect
(
view
.
model
.
get
(
'
passwordprotected
'
)).
toBe
(
true
);
expect
(
view
.
model
.
get
(
'
passwordprotected
'
)).
toBe
(
true
);
expect
(
view
.
model
.
get
(
'
hidden
'
)).
toBe
(
true
);
expect
(
view
.
model
.
get
(
'
hidden
'
)).
toBe
(
true
);
...
@@ -1849,6 +1851,7 @@
...
@@ -1849,6 +1851,7 @@
expect
(
view
.
model
.
get
(
'
unmoderated
'
)).
toBe
(
true
);
expect
(
view
.
model
.
get
(
'
unmoderated
'
)).
toBe
(
true
);
expect
(
view
.
model
.
get
(
'
nonanonymous
'
)).
toBe
(
true
);
expect
(
view
.
model
.
get
(
'
nonanonymous
'
)).
toBe
(
true
);
done
();
done
();
});
}));
}));
it
(
"
updates the shown features when the room configuration has changed
"
,
it
(
"
updates the shown features when the room configuration has changed
"
,
...
@@ -2946,6 +2949,7 @@
...
@@ -2946,6 +2949,7 @@
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
var
sent_IQs
=
[],
IQ_ids
=
[];
var
sent_IQs
=
[],
IQ_ids
=
[];
var
invitee_jid
,
sent_stanza
,
sent_id
;
var
sendIQ
=
_converse
.
connection
.
sendIQ
;
var
sendIQ
=
_converse
.
connection
.
sendIQ
;
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
,
errback
)
{
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
,
errback
)
{
sent_IQs
.
push
(
iq
);
sent_IQs
.
push
(
iq
);
...
@@ -2954,6 +2958,9 @@
...
@@ -2954,6 +2958,9 @@
_converse
.
api
.
rooms
.
open
(
'
coven@chat.shakespeare.lit
'
,
{
'
nick
'
:
'
dummy
'
});
_converse
.
api
.
rooms
.
open
(
'
coven@chat.shakespeare.lit
'
,
{
'
nick
'
:
'
dummy
'
});
var
view
=
_converse
.
chatboxviews
.
get
(
'
coven@chat.shakespeare.lit
'
);
spyOn
(
view
.
model
,
'
parseRoomFeatures
'
).
and
.
callThrough
();
// State that the chat is members-only via the features IQ
// State that the chat is members-only via the features IQ
var
features_stanza
=
$iq
({
var
features_stanza
=
$iq
({
from
:
'
coven@chat.shakespeare.lit
'
,
from
:
'
coven@chat.shakespeare.lit
'
,
...
@@ -2973,12 +2980,12 @@
...
@@ -2973,12 +2980,12 @@
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_membersonly
'
}).
up
();
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_membersonly
'
}).
up
();
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
features_stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
features_stanza
));
var
view
=
_converse
.
chatboxviews
.
get
(
'
coven@chat.shakespeare.lit
'
);
test_utils
.
waitUntil
(()
=>
view
.
model
.
parseRoomFeatures
.
calls
.
count
(),
300
)
.
then
(()
=>
{
expect
(
view
.
model
.
get
(
'
membersonly
'
)).
toBeTruthy
();
expect
(
view
.
model
.
get
(
'
membersonly
'
)).
toBeTruthy
();
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
var
sent_stanza
,
sent_id
;
spyOn
(
_converse
.
connection
,
'
send
'
).
and
.
callFake
(
function
(
stanza
)
{
spyOn
(
_converse
.
connection
,
'
send
'
).
and
.
callFake
(
function
(
stanza
)
{
if
(
stanza
.
nodeTree
&&
stanza
.
nodeTree
.
nodeName
===
'
message
'
)
{
if
(
stanza
.
nodeTree
&&
stanza
.
nodeTree
.
nodeName
===
'
message
'
)
{
sent_id
=
stanza
.
nodeTree
.
getAttribute
(
'
id
'
);
sent_id
=
stanza
.
nodeTree
.
getAttribute
(
'
id
'
);
...
@@ -2986,7 +2993,7 @@
...
@@ -2986,7 +2993,7 @@
}
}
});
});
var
name
=
mock
.
cur_names
[
0
];
var
name
=
mock
.
cur_names
[
0
];
var
invitee_jid
=
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
invitee_jid
=
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
reason
=
"
Please join this chat room
"
;
var
reason
=
"
Please join this chat room
"
;
view
.
model
.
directInvite
(
invitee_jid
,
reason
);
view
.
model
.
directInvite
(
invitee_jid
,
reason
);
...
@@ -3067,10 +3074,8 @@
...
@@ -3067,10 +3074,8 @@
'
jid
'
:
'
crone1@shakespeare.lit
'
,
'
jid
'
:
'
crone1@shakespeare.lit
'
,
});
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
owner_list_stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
owner_list_stanza
));
return
test_utils
.
waitUntil
(()
=>
IQ_ids
.
length
,
300
);
test_utils
.
waitUntil
(
function
()
{
}).
then
(()
=>
{
return
IQ_ids
.
length
;
},
300
).
then
(
function
()
{
// Check that the member list now gets updated
// Check that the member list now gets updated
var
iq
=
"
<iq to='coven@chat.shakespeare.lit' type='set' xmlns='jabber:client' id='
"
+
IQ_ids
.
pop
()
+
"
'>
"
+
var
iq
=
"
<iq to='coven@chat.shakespeare.lit' type='set' xmlns='jabber:client' id='
"
+
IQ_ids
.
pop
()
+
"
'>
"
+
"
<query xmlns='http://jabber.org/protocol/muc#admin'>
"
+
"
<query xmlns='http://jabber.org/protocol/muc#admin'>
"
+
...
@@ -3079,10 +3084,8 @@
...
@@ -3079,10 +3084,8 @@
"
</item>
"
+
"
</item>
"
+
"
</query>
"
+
"
</query>
"
+
"
</iq>
"
;
"
</iq>
"
;
return
test_utils
.
waitUntil
(()
=>
_
.
includes
(
_
.
invokeMap
(
sent_IQs
,
Object
.
prototype
.
toLocaleString
),
iq
),
300
);
test_utils
.
waitUntil
(
function
()
{
}).
then
(()
=>
{
return
_
.
includes
(
_
.
invokeMap
(
sent_IQs
,
Object
.
prototype
.
toLocaleString
),
iq
);
},
300
).
then
(
function
()
{
// Finally check that the user gets invited.
// Finally check that the user gets invited.
expect
(
sent_stanza
.
toLocaleString
()).
toBe
(
// Strophe adds the xmlns attr (although not in spec)
expect
(
sent_stanza
.
toLocaleString
()).
toBe
(
// Strophe adds the xmlns attr (although not in spec)
"
<message from='dummy@localhost/resource' to='
"
+
invitee_jid
+
"
' id='
"
+
sent_id
+
"
' xmlns='jabber:client'>
"
+
"
<message from='dummy@localhost/resource' to='
"
+
invitee_jid
+
"
' id='
"
+
sent_id
+
"
' xmlns='jabber:client'>
"
+
...
@@ -3091,7 +3094,6 @@
...
@@ -3091,7 +3094,6 @@
);
);
done
();
done
();
});
});
});
}));
}));
});
});
...
...
src/converse-muc.js
View file @
cc98cea0
...
@@ -403,6 +403,7 @@
...
@@ -403,6 +403,7 @@
};
};
if
(
reason
!==
null
)
{
attrs
.
reason
=
reason
;
}
if
(
reason
!==
null
)
{
attrs
.
reason
=
reason
;
}
if
(
this
.
get
(
'
password
'
))
{
attrs
.
password
=
this
.
get
(
'
password
'
);
}
if
(
this
.
get
(
'
password
'
))
{
attrs
.
password
=
this
.
get
(
'
password
'
);
}
const
invitation
=
$msg
({
const
invitation
=
$msg
({
from
:
_converse
.
connection
.
jid
,
from
:
_converse
.
connection
.
jid
,
to
:
recipient
,
to
:
recipient
,
...
@@ -1126,7 +1127,7 @@
...
@@ -1126,7 +1127,7 @@
if
(
_converse
.
allow_muc_invitations
)
{
if
(
_converse
.
allow_muc_invitations
)
{
const
registerDirectInvitationHandler
=
function
()
{
const
registerDirectInvitationHandler
=
function
()
{
_converse
.
connection
.
addHandler
(
_converse
.
connection
.
addHandler
(
function
(
message
)
{
(
message
)
=>
{
_converse
.
onDirectMUCInvitation
(
message
);
_converse
.
onDirectMUCInvitation
(
message
);
return
true
;
return
true
;
},
'
jabber:x:conference
'
,
'
message
'
);
},
'
jabber:x:conference
'
,
'
message
'
);
...
...
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