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
2977643b
Commit
2977643b
authored
Mar 18, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing tests
parent
877acd16
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
29 deletions
+30
-29
spec/controlbox.js
spec/controlbox.js
+10
-8
spec/roster.js
spec/roster.js
+19
-20
tests/runner.js
tests/runner.js
+1
-1
No files found.
spec/controlbox.js
View file @
2977643b
...
...
@@ -152,19 +152,21 @@
describe
(
"
The 'Add Contact' widget
"
,
function
()
{
it
(
"
opens up an add
form
when you click on it
"
,
it
(
"
opens up an add
modal
when you click on it
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
var
panel
=
_converse
.
chatboxviews
.
get
(
'
controlbox
'
).
contactspanel
;
spyOn
(
panel
,
'
toggleContactForm
'
).
and
.
callThrough
();
panel
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
panel
.
el
.
querySelector
(
'
a.toggle-xmpp-contact-form
'
).
click
();
expect
(
panel
.
toggleContactForm
).
toHaveBeenCalled
();
// XXX: Awaiting more tests, close it again for now...
panel
.
el
.
querySelector
(
'
a.toggle-xmpp-contact-form
'
).
click
();
var
cbview
=
_converse
.
chatboxviews
.
get
(
'
controlbox
'
);
cbview
.
el
.
querySelector
(
'
.add-contact
'
).
click
()
var
modal
=
_converse
.
rosterview
.
add_contact_modal
;
return
test_utils
.
waitUntil
(
function
()
{
return
u
.
isVisible
(
modal
.
el
);
},
1000
).
then
(
function
()
{
expect
(
!
_
.
isNull
(
modal
.
el
.
querySelector
(
'
form.add-xmpp-contact
'
))).
toBeTruthy
();
done
();
});
}));
it
(
"
can be used to add contact and it checks for case-sensivity
"
,
...
...
spec/roster.js
View file @
2977643b
...
...
@@ -9,25 +9,25 @@
var
checkHeaderToggling
=
function
(
group
)
{
var
$group
=
$
(
group
);
var
$toggle
=
$group
.
find
(
'
a.group-toggle
'
);
var
toggle
=
group
.
querySelector
(
'
a.group-toggle
'
);
expect
(
u
.
isVisible
(
$group
[
0
])).
toBeTruthy
();
expect
(
$group
.
find
(
'
ul.collapsed
'
).
length
).
toBe
(
0
);
expect
(
$toggle
.
hasClass
(
'
icon-closed
'
)).
toBeFalsy
();
expect
(
$toggle
.
hasClass
(
'
icon-opened
'
)).
toBeTruthy
();
$toggle
[
0
]
.
click
();
expect
(
u
.
hasClass
(
'
fa-caret-right
'
,
toggle
.
firstElementChild
)).
toBeFalsy
();
expect
(
u
.
hasClass
(
'
fa-caret-down
'
,
toggle
.
firstElementChild
)).
toBeTruthy
();
toggle
.
click
();
return
test_utils
.
waitUntil
(
function
()
{
return
$group
.
find
(
'
ul.collapsed
'
).
length
===
1
;
},
500
).
then
(
function
()
{
expect
(
$toggle
.
hasClass
(
'
icon-closed
'
)).
toBeTruthy
();
expect
(
$toggle
.
hasClass
(
'
icon-opened
'
)).
toBeFalsy
();
$toggle
[
0
]
.
click
();
expect
(
u
.
hasClass
(
'
fa-caret-right
'
,
toggle
.
firstElementChild
)).
toBeTruthy
();
expect
(
u
.
hasClass
(
'
fa-caret-down
'
,
toggle
.
firstElementChild
)).
toBeFalsy
();
toggle
.
click
();
return
test_utils
.
waitUntil
(
function
()
{
return
$group
.
find
(
'
li
'
).
length
===
$group
.
find
(
'
li:visible
'
).
length
},
500
);
}).
then
(
function
()
{
expect
(
$toggle
.
hasClass
(
'
icon-closed
'
)).
toBeFalsy
();
expect
(
$toggle
.
hasClass
(
'
icon-opened
'
)).
toBeTruthy
();
expect
(
u
.
hasClass
(
'
fa-caret-right
'
,
toggle
.
firstElementChild
)).
toBeFalsy
();
expect
(
u
.
hasClass
(
'
fa-caret-down
'
,
toggle
.
firstElementChild
)).
toBeTruthy
();
});
};
...
...
@@ -1111,6 +1111,7 @@
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
test_utils
.
openControlBox
();
var
name
=
mock
.
req_names
[
0
];
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
_converse
.
roster
.
create
({
...
...
@@ -1122,11 +1123,10 @@
});
test_utils
.
waitUntil
(
function
()
{
return
$
(
_converse
.
rosterview
.
el
).
find
(
'
.roster-group:visible li
'
).
length
;
},
7
00
).
then
(
function
()
{
},
9
00
).
then
(
function
()
{
expect
(
u
.
isVisible
(
_converse
.
rosterview
.
get
(
'
Contact requests
'
).
el
)).
toEqual
(
true
);
$
(
_converse
.
rosterview
.
el
).
find
(
"
.req-contact-name:contains('
"
+
name
+
"
')
"
)
.
parent
().
siblings
(
'
.request-actions
'
)
.
find
(
'
.decline-xmpp-request
'
)[
0
].
click
();
expect
(
$
(
_converse
.
rosterview
.
el
).
find
(
'
.roster-group:visible li
'
).
length
).
toBe
(
1
);
$
(
_converse
.
rosterview
.
el
).
find
(
'
.roster-group:visible li .decline-xmpp-request
'
)[
0
].
click
();
expect
(
window
.
confirm
).
toHaveBeenCalled
();
expect
(
u
.
isVisible
(
_converse
.
rosterview
.
get
(
'
Contact requests
'
).
el
)).
toEqual
(
false
);
done
();
...
...
@@ -1154,6 +1154,7 @@
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
test_utils
.
openControlBox
();
test_utils
.
createContacts
(
_converse
,
'
requesting
'
).
openControlBox
();
test_utils
.
waitUntil
(
function
()
{
return
$
(
_converse
.
rosterview
.
el
).
find
(
'
.roster-group li
'
).
length
;
...
...
@@ -1169,8 +1170,7 @@
});
spyOn
(
contact
,
'
authorize
'
).
and
.
callFake
(
function
()
{
return
contact
;
});
$
(
_converse
.
rosterview
.
el
).
find
(
"
.req-contact-name:contains('
"
+
name
+
"
')
"
)
.
parent
().
siblings
(
'
.request-actions
'
)
.
find
(
'
.accept-xmpp-request
'
)[
0
].
click
();
.
parent
().
parent
().
find
(
'
.accept-xmpp-request
'
)[
0
].
click
();
expect
(
_converse
.
roster
.
sendContactAddIQ
).
toHaveBeenCalled
();
expect
(
contact
.
authorize
).
toHaveBeenCalled
();
done
();
...
...
@@ -1193,8 +1193,7 @@
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
spyOn
(
contact
,
'
unauthorize
'
).
and
.
callFake
(
function
()
{
return
contact
;
});
$
(
_converse
.
rosterview
.
el
).
find
(
"
.req-contact-name:contains('
"
+
name
+
"
')
"
)
.
parent
().
siblings
(
'
.request-actions
'
)
.
find
(
'
.decline-xmpp-request
'
)[
0
].
click
();
.
parent
().
parent
().
find
(
'
.decline-xmpp-request
'
)[
0
].
click
();
expect
(
window
.
confirm
).
toHaveBeenCalled
();
expect
(
contact
.
unauthorize
).
toHaveBeenCalled
();
// There should now be one less contact
...
...
tests/runner.js
View file @
2977643b
...
...
@@ -32,7 +32,7 @@ require.config(config);
var
specs
=
[
"
jasmine
"
,
"
spec/transcripts
"
,
//
"spec/transcripts",
"
spec/spoilers
"
,
"
spec/profiling
"
,
"
spec/utils
"
,
...
...
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