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
713e49b0
Commit
713e49b0
authored
Jul 19, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing tests
parent
f84790e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
14 deletions
+25
-14
spec/mam.js
spec/mam.js
+2
-1
spec/protocol.js
spec/protocol.js
+19
-10
src/utils.js
src/utils.js
+4
-3
No files found.
spec/mam.js
View file @
713e49b0
...
...
@@ -3,6 +3,7 @@
}
(
this
,
function
(
$
,
jasmine
,
mock
,
converse
,
test_utils
)
{
"
use strict
"
;
var
_
=
converse
.
env
.
_
;
var
Backbone
=
converse
.
env
.
Backbone
;
var
Strophe
=
converse
.
env
.
Strophe
;
var
$iq
=
converse
.
env
.
$iq
;
var
$msg
=
converse
.
env
.
$msg
;
...
...
@@ -371,7 +372,7 @@
spyOn
(
_converse
,
'
onMAMPreferences
'
).
and
.
callThrough
();
_converse
.
message_archiving
=
'
never
'
;
var
feature
=
new
_converse
.
Feature
({
var
feature
=
new
Backbone
.
Model
({
'
var
'
:
Strophe
.
NS
.
MAM
});
spyOn
(
feature
,
'
save
'
).
and
.
callFake
(
feature
.
set
);
// Save will complain about a url not being set
...
...
spec/protocol.js
View file @
713e49b0
...
...
@@ -73,15 +73,20 @@
panel
.
delegateEvents
();
// Rebind all events so that our spy gets called
/* Add a new contact through the UI */
var
$form
=
panel
.
$
(
'
form.add-xmpp-contact
'
);
expect
(
$form
.
is
(
"
:visible
"
)).
toBeFalsy
();
var
form
=
panel
.
el
.
querySelector
(
'
form.add-xmpp-contact
'
);
expect
(
_
.
isNull
(
form
)).
toBeTruthy
();
// Click the "Add a contact" link.
panel
.
$
(
'
.toggle-xmpp-contact-form
'
).
click
();
// Check that the $form appears
expect
(
$form
.
is
(
"
:visible
"
)).
toBeTruthy
();
// Check that the form appears
form
=
panel
.
el
.
querySelector
(
'
form.add-xmpp-contact
'
);
expect
(
form
.
parentElement
.
offsetHeight
).
not
.
toBe
(
0
);
expect
(
_
.
includes
(
form
.
parentElement
.
classList
,
'
collapsed
'
)).
toBeFalsy
();
// Fill in the form and submit
$
form
.
find
(
'
input
'
).
val
(
'
contact@example.org
'
);
$
form
.
submit
();
$
(
form
)
.
find
(
'
input
'
).
val
(
'
contact@example.org
'
);
$
(
form
)
.
submit
();
/* In preparation for being able to render the contact in the
* user's client interface and for the server to keep track of the
...
...
@@ -91,8 +96,11 @@
expect
(
panel
.
addContactFromForm
).
toHaveBeenCalled
();
expect
(
_converse
.
roster
.
addAndSubscribe
).
toHaveBeenCalled
();
expect
(
_converse
.
roster
.
addContact
).
toHaveBeenCalled
();
// The form should not be visible anymore.
expect
(
$form
.
is
(
"
:visible
"
)).
toBeFalsy
();
// The form should not be visible anymore (by virtue of its
// parent being collapsed)
expect
(
form
.
parentElement
.
offsetHeight
).
toBe
(
0
);
expect
(
_
.
includes
(
form
.
parentElement
.
classList
,
'
collapsed
'
)).
toBeTrue
;
/* _converse request consists of sending an IQ
* stanza of type='set' containing a <query/> element qualified by
...
...
@@ -175,7 +183,7 @@
test_utils
.
waitUntil
(
function
()
{
return
sent_stanzas
.
length
==
1
;
}).
then
(
function
()
{
}
,
300
).
then
(
function
()
{
expect
(
contact
.
subscribe
).
toHaveBeenCalled
();
expect
(
sent_stanza
.
toLocaleString
()).
toBe
(
// Strophe adds the xmlns attr (although not in spec)
...
...
@@ -216,7 +224,8 @@
// contact in the roster.
test_utils
.
waitUntil
(
function
()
{
return
$
(
'
a:contains("Pending contacts")
'
).
length
;
}).
then
(
function
()
{
},
300
).
then
(
function
()
{
var
$header
=
$
(
'
a:contains("Pending contacts")
'
);
expect
(
$header
.
length
).
toBe
(
1
);
expect
(
$header
.
is
(
"
:visible
"
)).
toBeTruthy
();
...
...
src/utils.js
View file @
713e49b0
...
...
@@ -273,7 +273,8 @@
}
else
if
(
_
.
includes
(
el
.
classList
,
'
collapsed
'
))
{
return
resolve
();
}
else
if
(
$
.
fx
.
off
)
{
// Effects are disabled (for tests)
el
.
style
.
height
=
0
+
'
px
'
;
el
.
classList
.
add
(
'
collapsed
'
);
el
.
style
.
height
=
""
;
return
resolve
();
}
let
interval_marker
=
el
.
getAttribute
(
'
data-slider-marker
'
);
...
...
@@ -292,10 +293,10 @@
if
(
h
>
0
)
{
el
.
style
.
height
=
h
+
'
px
'
;
}
else
{
el
.
removeAttribute
(
'
data-slider-marker
'
);
window
.
clearInterval
(
interval_marker
);
el
.
classList
.
add
(
'
collapsed
'
);
el
.
style
.
height
=
""
;
window
.
clearInterval
(
interval_marker
);
el
.
removeAttribute
(
'
data-slider-marker
'
);
resolve
();
}
},
interval
);
...
...
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