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
2a593a03
Commit
2a593a03
authored
Aug 14, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test spec for autocompletion
parent
5ded3b6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
spec/autocomplete.js
spec/autocomplete.js
+55
-0
tests/runner.js
tests/runner.js
+1
-0
No files found.
spec/autocomplete.js
0 → 100644
View file @
2a593a03
(
function
(
root
,
factory
)
{
define
([
"
jasmine
"
,
"
mock
"
,
"
test-utils
"
],
factory
);
}
(
this
,
function
(
jasmine
,
mock
,
test_utils
)
{
"
use strict
"
;
const
_
=
converse
.
env
.
_
;
const
$iq
=
converse
.
env
.
$iq
;
const
$msg
=
converse
.
env
.
$msg
;
const
$pres
=
converse
.
env
.
$pres
;
const
Strophe
=
converse
.
env
.
Strophe
;
const
u
=
converse
.
env
.
utils
;
const
sizzle
=
converse
.
env
.
sizzle
;
return
describe
(
"
A groupchat textarea
"
,
function
()
{
it
(
"
autocompletes when the user presses tab
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
)
.
then
(()
=>
{
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
expect
(
view
.
model
.
occupants
.
length
).
toBe
(
1
);
const
presence
=
$pres
({
'
to
'
:
'
dummy@localhost/resource
'
,
'
from
'
:
'
lounge@localhost/some1
'
})
.
c
(
'
x
'
,
{
xmlns
:
Strophe
.
NS
.
MUC_USER
})
.
c
(
'
item
'
,
{
'
affiliation
'
:
'
none
'
,
'
jid
'
:
'
some1@localhost/resource
'
,
'
role
'
:
'
participant
'
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
expect
(
view
.
model
.
occupants
.
length
).
toBe
(
2
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
textarea
.
value
=
"
hello som
"
;
// Press tab
view
.
keyPressed
({
target
:
textarea
,
preventDefault
:
_
.
noop
,
keyCode
:
9
});
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results
'
).
hidden
).
toBeFalsy
();
done
();
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}));
});
}));
tests/runner.js
View file @
2a593a03
...
...
@@ -201,6 +201,7 @@ var specs = [
"
spec/user-details-modal
"
,
"
spec/messages
"
,
"
spec/chatroom
"
,
"
spec/autocomplete
"
,
"
spec/minchats
"
,
"
spec/notification
"
,
"
spec/login
"
,
...
...
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