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
e1762a1b
Commit
e1762a1b
authored
May 26, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename key event handler methods to avoid confusion
parent
5054ecca
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
92 additions
and
92 deletions
+92
-92
spec/autocomplete.js
spec/autocomplete.js
+17
-17
spec/chatbox.js
spec/chatbox.js
+7
-7
spec/messages.js
spec/messages.js
+27
-27
spec/muc.js
spec/muc.js
+22
-22
spec/omemo.js
spec/omemo.js
+5
-5
spec/room_registration.js
spec/room_registration.js
+1
-1
spec/spoilers.js
spec/spoilers.js
+2
-2
src/converse-autocomplete.js
src/converse-autocomplete.js
+1
-1
src/converse-chatview.js
src/converse-chatview.js
+2
-2
src/converse-headline.js
src/converse-headline.js
+1
-1
src/converse-muc-views.js
src/converse-muc-views.js
+6
-6
tests/utils.js
tests/utils.js
+1
-1
No files found.
spec/autocomplete.js
View file @
e1762a1b
...
@@ -46,9 +46,9 @@
...
@@ -46,9 +46,9 @@
'
keyCode
'
:
50
,
'
keyCode
'
:
50
,
'
key
'
:
'
@
'
'
key
'
:
'
@
'
};
};
view
.
keyPressed
(
at_event
);
view
.
onKeyDown
(
at_event
);
textarea
.
value
=
'
@
'
;
textarea
.
value
=
'
@
'
;
view
.
k
eyUp
(
at_event
);
view
.
onK
eyUp
(
at_event
);
expect
(
view
.
el
.
querySelectorAll
(
'
.suggestion-box__results li
'
).
length
).
toBe
(
3
);
expect
(
view
.
el
.
querySelectorAll
(
'
.suggestion-box__results li
'
).
length
).
toBe
(
3
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results li:first-child
'
).
textContent
).
toBe
(
'
dick
'
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results li:first-child
'
).
textContent
).
toBe
(
'
dick
'
);
...
@@ -89,8 +89,8 @@
...
@@ -89,8 +89,8 @@
'
keyCode
'
:
9
,
'
keyCode
'
:
9
,
'
key
'
:
'
Tab
'
'
key
'
:
'
Tab
'
}
}
view
.
keyPressed
(
tab_event
);
view
.
onKeyDown
(
tab_event
);
view
.
k
eyUp
(
tab_event
);
view
.
onK
eyUp
(
tab_event
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results
'
).
hidden
).
toBeFalsy
();
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results
'
).
hidden
).
toBeFalsy
();
expect
(
view
.
el
.
querySelectorAll
(
'
.suggestion-box__results li
'
).
length
).
toBe
(
1
);
expect
(
view
.
el
.
querySelectorAll
(
'
.suggestion-box__results li
'
).
length
).
toBe
(
1
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results li
'
).
textContent
).
toBe
(
'
some1
'
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results li
'
).
textContent
).
toBe
(
'
some1
'
);
...
@@ -102,9 +102,9 @@
...
@@ -102,9 +102,9 @@
}
}
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
// Press backspace 3 times to remove "som"
// Press backspace 3 times to remove "som"
view
.
keyPressed
(
backspace_event
);
view
.
onKeyDown
(
backspace_event
);
textarea
.
value
=
textarea
.
value
.
slice
(
0
,
textarea
.
value
.
length
-
1
)
textarea
.
value
=
textarea
.
value
.
slice
(
0
,
textarea
.
value
.
length
-
1
)
view
.
k
eyUp
(
backspace_event
);
view
.
onK
eyUp
(
backspace_event
);
}
}
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results
'
).
hidden
).
toBeTruthy
();
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results
'
).
hidden
).
toBeTruthy
();
...
@@ -121,8 +121,8 @@
...
@@ -121,8 +121,8 @@
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
textarea
.
value
=
"
hello s s
"
;
textarea
.
value
=
"
hello s s
"
;
view
.
keyPressed
(
tab_event
);
view
.
onKeyDown
(
tab_event
);
view
.
k
eyUp
(
tab_event
);
view
.
onK
eyUp
(
tab_event
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results
'
).
hidden
).
toBeFalsy
();
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results
'
).
hidden
).
toBeFalsy
();
expect
(
view
.
el
.
querySelectorAll
(
'
.suggestion-box__results li
'
).
length
).
toBe
(
2
);
expect
(
view
.
el
.
querySelectorAll
(
'
.suggestion-box__results li
'
).
length
).
toBe
(
2
);
...
@@ -132,13 +132,13 @@
...
@@ -132,13 +132,13 @@
'
stopPropagation
'
:
_
.
noop
,
'
stopPropagation
'
:
_
.
noop
,
'
keyCode
'
:
38
'
keyCode
'
:
38
}
}
view
.
keyPressed
(
up_arrow_event
);
view
.
onKeyDown
(
up_arrow_event
);
view
.
k
eyUp
(
up_arrow_event
);
view
.
onK
eyUp
(
up_arrow_event
);
expect
(
view
.
el
.
querySelectorAll
(
'
.suggestion-box__results li
'
).
length
).
toBe
(
2
);
expect
(
view
.
el
.
querySelectorAll
(
'
.suggestion-box__results li
'
).
length
).
toBe
(
2
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results li[aria-selected="false"]
'
).
textContent
).
toBe
(
'
some1
'
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results li[aria-selected="false"]
'
).
textContent
).
toBe
(
'
some1
'
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results li[aria-selected="true"]
'
).
textContent
).
toBe
(
'
some2
'
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results li[aria-selected="true"]
'
).
textContent
).
toBe
(
'
some2
'
);
view
.
keyPressed
({
view
.
onKeyDown
({
'
target
'
:
textarea
,
'
target
'
:
textarea
,
'
preventDefault
'
:
_
.
noop
,
'
preventDefault
'
:
_
.
noop
,
'
stopPropagation
'
:
_
.
noop
,
'
stopPropagation
'
:
_
.
noop
,
...
@@ -159,11 +159,11 @@
...
@@ -159,11 +159,11 @@
});
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
textarea
.
value
=
"
hello z
"
;
textarea
.
value
=
"
hello z
"
;
view
.
keyPressed
(
tab_event
);
view
.
onKeyDown
(
tab_event
);
view
.
k
eyUp
(
tab_event
);
view
.
onK
eyUp
(
tab_event
);
view
.
keyPressed
(
tab_event
);
view
.
onKeyDown
(
tab_event
);
view
.
k
eyUp
(
tab_event
);
view
.
onK
eyUp
(
tab_event
);
expect
(
textarea
.
value
).
toBe
(
'
hello @z3r0
'
);
expect
(
textarea
.
value
).
toBe
(
'
hello @z3r0
'
);
done
();
done
();
}));
}));
...
@@ -200,9 +200,9 @@
...
@@ -200,9 +200,9 @@
'
keyCode
'
:
8
,
'
keyCode
'
:
8
,
'
key
'
:
'
Backspace
'
'
key
'
:
'
Backspace
'
}
}
view
.
keyPressed
(
backspace_event
);
view
.
onKeyDown
(
backspace_event
);
textarea
.
value
=
"
hello @some1
"
;
// Mimic backspace
textarea
.
value
=
"
hello @some1
"
;
// Mimic backspace
view
.
k
eyUp
(
backspace_event
);
view
.
onK
eyUp
(
backspace_event
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results
'
).
hidden
).
toBeFalsy
();
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results
'
).
hidden
).
toBeFalsy
();
expect
(
view
.
el
.
querySelectorAll
(
'
.suggestion-box__results li
'
).
length
).
toBe
(
1
);
expect
(
view
.
el
.
querySelectorAll
(
'
.suggestion-box__results li
'
).
length
).
toBe
(
1
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results li
'
).
textContent
).
toBe
(
'
some1
'
);
expect
(
view
.
el
.
querySelector
(
'
.suggestion-box__results li
'
).
textContent
).
toBe
(
'
some1
'
);
...
...
spec/chatbox.js
View file @
e1762a1b
...
@@ -638,7 +638,7 @@
...
@@ -638,7 +638,7 @@
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
active
'
);
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
active
'
);
spyOn
(
_converse
.
connection
,
'
send
'
);
spyOn
(
_converse
.
connection
,
'
send
'
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
keyCode
:
1
keyCode
:
1
});
});
...
@@ -653,7 +653,7 @@
...
@@ -653,7 +653,7 @@
expect
(
stanza
.
childNodes
[
2
].
tagName
).
toBe
(
'
no-permanent-store
'
);
expect
(
stanza
.
childNodes
[
2
].
tagName
).
toBe
(
'
no-permanent-store
'
);
// The notification is not sent again
// The notification is not sent again
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
keyCode
:
1
keyCode
:
1
});
});
...
@@ -768,7 +768,7 @@
...
@@ -768,7 +768,7 @@
spyOn
(
_converse
.
connection
,
'
send
'
);
spyOn
(
_converse
.
connection
,
'
send
'
);
spyOn
(
view
,
'
setChatState
'
).
and
.
callThrough
();
spyOn
(
view
,
'
setChatState
'
).
and
.
callThrough
();
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
active
'
);
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
active
'
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
keyCode
:
1
keyCode
:
1
});
});
...
@@ -792,14 +792,14 @@
...
@@ -792,14 +792,14 @@
// Test #359. A paused notification should not be sent
// Test #359. A paused notification should not be sent
// out if the user simply types longer than the
// out if the user simply types longer than the
// timeout.
// timeout.
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
keyCode
:
1
keyCode
:
1
});
});
expect
(
view
.
setChatState
).
toHaveBeenCalled
();
expect
(
view
.
setChatState
).
toHaveBeenCalled
();
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
composing
'
);
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
composing
'
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
keyCode
:
1
keyCode
:
1
});
});
...
@@ -899,7 +899,7 @@
...
@@ -899,7 +899,7 @@
await
test_utils
.
waitUntil
(()
=>
view
.
model
.
get
(
'
chat_state
'
)
===
'
active
'
,
1000
);
await
test_utils
.
waitUntil
(()
=>
view
.
model
.
get
(
'
chat_state
'
)
===
'
active
'
,
1000
);
console
.
log
(
'
chat_state set to active
'
);
console
.
log
(
'
chat_state set to active
'
);
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
active
'
);
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
active
'
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
keyCode
:
1
keyCode
:
1
});
});
...
@@ -1075,7 +1075,7 @@
...
@@ -1075,7 +1075,7 @@
return
true
;
return
true
;
});
});
view
.
el
.
querySelector
(
'
.chat-textarea
'
).
value
=
message
;
view
.
el
.
querySelector
(
'
.chat-textarea
'
).
value
=
message
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
...
spec/messages.js
View file @
e1762a1b
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
spyOn
(
_converse
.
connection
,
'
send
'
);
spyOn
(
_converse
.
connection
,
'
send
'
);
textarea
.
value
=
'
But soft, what light through yonder window breaks?
'
;
textarea
.
value
=
'
But soft, what light through yonder window breaks?
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -131,14 +131,14 @@
...
@@ -131,14 +131,14 @@
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
expect
(
textarea
.
value
).
toBe
(
''
);
expect
(
textarea
.
value
).
toBe
(
''
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
keyCode
:
38
// Up arrow
keyCode
:
38
// Up arrow
});
});
expect
(
textarea
.
value
).
toBe
(
''
);
expect
(
textarea
.
value
).
toBe
(
''
);
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -150,7 +150,7 @@
...
@@ -150,7 +150,7 @@
const
first_msg
=
view
.
model
.
messages
.
findWhere
({
'
message
'
:
'
But soft, what light through yonder airlock breaks?
'
});
const
first_msg
=
view
.
model
.
messages
.
findWhere
({
'
message
'
:
'
But soft, what light through yonder airlock breaks?
'
});
expect
(
textarea
.
value
).
toBe
(
''
);
expect
(
textarea
.
value
).
toBe
(
''
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
keyCode
:
38
// Up arrow
keyCode
:
38
// Up arrow
});
});
...
@@ -161,7 +161,7 @@
...
@@ -161,7 +161,7 @@
spyOn
(
_converse
.
connection
,
'
send
'
);
spyOn
(
_converse
.
connection
,
'
send
'
);
textarea
.
value
=
'
But soft, what light through yonder window breaks?
'
;
textarea
.
value
=
'
But soft, what light through yonder window breaks?
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -195,7 +195,7 @@
...
@@ -195,7 +195,7 @@
// Test that pressing the down arrow cancels message correction
// Test that pressing the down arrow cancels message correction
expect
(
textarea
.
value
).
toBe
(
''
);
expect
(
textarea
.
value
).
toBe
(
''
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
keyCode
:
38
// Up arrow
keyCode
:
38
// Up arrow
});
});
...
@@ -204,7 +204,7 @@
...
@@ -204,7 +204,7 @@
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
1
);
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
1
);
await
test_utils
.
waitUntil
(()
=>
u
.
hasClass
(
'
correcting
'
,
view
.
el
.
querySelector
(
'
.chat-msg
'
)),
500
);
await
test_utils
.
waitUntil
(()
=>
u
.
hasClass
(
'
correcting
'
,
view
.
el
.
querySelector
(
'
.chat-msg
'
)),
500
);
expect
(
textarea
.
value
).
toBe
(
'
But soft, what light through yonder window breaks?
'
);
expect
(
textarea
.
value
).
toBe
(
'
But soft, what light through yonder window breaks?
'
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
keyCode
:
40
// Down arrow
keyCode
:
40
// Down arrow
});
});
...
@@ -214,7 +214,7 @@
...
@@ -214,7 +214,7 @@
await
test_utils
.
waitUntil
(()
=>
(
u
.
hasClass
(
'
correcting
'
,
view
.
el
.
querySelector
(
'
.chat-msg
'
))
===
false
),
500
);
await
test_utils
.
waitUntil
(()
=>
(
u
.
hasClass
(
'
correcting
'
,
view
.
el
.
querySelector
(
'
.chat-msg
'
))
===
false
),
500
);
textarea
.
value
=
'
It is the east, and Juliet is the one.
'
;
textarea
.
value
=
'
It is the east, and Juliet is the one.
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -223,7 +223,7 @@
...
@@ -223,7 +223,7 @@
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
2
);
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
2
);
textarea
.
value
=
'
Arise, fair sun, and kill the envious moon
'
;
textarea
.
value
=
'
Arise, fair sun, and kill the envious moon
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -231,7 +231,7 @@
...
@@ -231,7 +231,7 @@
await
new
Promise
((
resolve
,
reject
)
=>
view
.
once
(
'
messageInserted
'
,
resolve
));
await
new
Promise
((
resolve
,
reject
)
=>
view
.
once
(
'
messageInserted
'
,
resolve
));
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
3
);
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
3
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
keyCode
:
38
// Up arrow
keyCode
:
38
// Up arrow
});
});
...
@@ -243,7 +243,7 @@
...
@@ -243,7 +243,7 @@
textarea
.
selectionEnd
=
0
;
// Happens by pressing up,
textarea
.
selectionEnd
=
0
;
// Happens by pressing up,
// but for some reason not in tests, so we set it manually.
// but for some reason not in tests, so we set it manually.
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
keyCode
:
38
// Up arrow
keyCode
:
38
// Up arrow
});
});
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
await
test_utils
.
waitUntil
(()
=>
u
.
hasClass
(
'
correcting
'
,
sizzle
(
'
.chat-msg
'
,
view
.
el
)[
1
]),
500
);
await
test_utils
.
waitUntil
(()
=>
u
.
hasClass
(
'
correcting
'
,
sizzle
(
'
.chat-msg
'
,
view
.
el
)[
1
]),
500
);
textarea
.
value
=
'
It is the east, and Juliet is the sun.
'
;
textarea
.
value
=
'
It is the east, and Juliet is the sun.
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -1330,7 +1330,7 @@
...
@@ -1330,7 +1330,7 @@
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -1353,7 +1353,7 @@
...
@@ -1353,7 +1353,7 @@
// Also handle receipts with type 'chat'. See #1353
// Also handle receipts with type 'chat'. See #1353
spyOn
(
_converse
.
chatboxes
,
'
onMessage
'
).
and
.
callThrough
();
spyOn
(
_converse
.
chatboxes
,
'
onMessage
'
).
and
.
callThrough
();
textarea
.
value
=
'
Another message
'
;
textarea
.
value
=
'
Another message
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -2451,14 +2451,14 @@
...
@@ -2451,14 +2451,14 @@
const
view
=
_converse
.
api
.
chatviews
.
get
(
room_jid
);
const
view
=
_converse
.
api
.
chatviews
.
get
(
room_jid
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
expect
(
textarea
.
value
).
toBe
(
''
);
expect
(
textarea
.
value
).
toBe
(
''
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
keyCode
:
38
// Up arrow
keyCode
:
38
// Up arrow
});
});
expect
(
textarea
.
value
).
toBe
(
''
);
expect
(
textarea
.
value
).
toBe
(
''
);
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -2470,7 +2470,7 @@
...
@@ -2470,7 +2470,7 @@
const
first_msg
=
view
.
model
.
messages
.
findWhere
({
'
message
'
:
'
But soft, what light through yonder airlock breaks?
'
});
const
first_msg
=
view
.
model
.
messages
.
findWhere
({
'
message
'
:
'
But soft, what light through yonder airlock breaks?
'
});
expect
(
textarea
.
value
).
toBe
(
''
);
expect
(
textarea
.
value
).
toBe
(
''
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
keyCode
:
38
// Up arrow
keyCode
:
38
// Up arrow
});
});
...
@@ -2482,7 +2482,7 @@
...
@@ -2482,7 +2482,7 @@
spyOn
(
_converse
.
connection
,
'
send
'
);
spyOn
(
_converse
.
connection
,
'
send
'
);
textarea
.
value
=
'
But soft, what light through yonder window breaks?
'
;
textarea
.
value
=
'
But soft, what light through yonder window breaks?
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -2526,7 +2526,7 @@
...
@@ -2526,7 +2526,7 @@
// Test that pressing the down arrow cancels message correction
// Test that pressing the down arrow cancels message correction
expect
(
textarea
.
value
).
toBe
(
''
);
expect
(
textarea
.
value
).
toBe
(
''
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
keyCode
:
38
// Up arrow
keyCode
:
38
// Up arrow
});
});
...
@@ -2535,7 +2535,7 @@
...
@@ -2535,7 +2535,7 @@
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
2
);
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
2
);
await
test_utils
.
waitUntil
(()
=>
u
.
hasClass
(
'
correcting
'
,
view
.
el
.
querySelector
(
'
.chat-msg
'
)),
500
);
await
test_utils
.
waitUntil
(()
=>
u
.
hasClass
(
'
correcting
'
,
view
.
el
.
querySelector
(
'
.chat-msg
'
)),
500
);
expect
(
textarea
.
value
).
toBe
(
'
But soft, what light through yonder window breaks?
'
);
expect
(
textarea
.
value
).
toBe
(
'
But soft, what light through yonder window breaks?
'
);
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
keyCode
:
40
// Down arrow
keyCode
:
40
// Down arrow
});
});
...
@@ -2556,7 +2556,7 @@
...
@@ -2556,7 +2556,7 @@
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -2630,7 +2630,7 @@
...
@@ -2630,7 +2630,7 @@
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -2665,7 +2665,7 @@
...
@@ -2665,7 +2665,7 @@
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
textarea
.
value
=
'
But soft, what light through yonder airlock breaks?
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -2913,7 +2913,7 @@
...
@@ -2913,7 +2913,7 @@
'
keyCode
'
:
13
// Enter
'
keyCode
'
:
13
// Enter
}
}
spyOn
(
_converse
.
connection
,
'
send
'
);
spyOn
(
_converse
.
connection
,
'
send
'
);
view
.
keyPressed
(
enter_event
);
view
.
onKeyDown
(
enter_event
);
await
new
Promise
((
resolve
,
reject
)
=>
view
.
once
(
'
messageInserted
'
,
resolve
));
await
new
Promise
((
resolve
,
reject
)
=>
view
.
once
(
'
messageInserted
'
,
resolve
));
const
msg
=
_converse
.
connection
.
send
.
calls
.
all
()[
0
].
args
[
0
];
const
msg
=
_converse
.
connection
.
send
.
calls
.
all
()[
0
].
args
[
0
];
expect
(
msg
.
toLocaleString
())
expect
(
msg
.
toLocaleString
())
...
@@ -2939,7 +2939,7 @@
...
@@ -2939,7 +2939,7 @@
await
test_utils
.
waitUntil
(()
=>
u
.
hasClass
(
'
correcting
'
,
view
.
el
.
querySelector
(
'
.chat-msg
'
)),
500
);
await
test_utils
.
waitUntil
(()
=>
u
.
hasClass
(
'
correcting
'
,
view
.
el
.
querySelector
(
'
.chat-msg
'
)),
500
);
textarea
.
value
=
'
hello @z3r0 @gibson @sw0rdf1sh, how are you?
'
;
textarea
.
value
=
'
hello @z3r0 @gibson @sw0rdf1sh, how are you?
'
;
view
.
keyPressed
(
enter_event
);
view
.
onKeyDown
(
enter_event
);
await
test_utils
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.chat-msg__text
'
).
textContent
===
await
test_utils
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.chat-msg__text
'
).
textContent
===
'
hello z3r0 gibson sw0rdf1sh, how are you?
'
,
500
);
'
hello z3r0 gibson sw0rdf1sh, how are you?
'
,
500
);
...
@@ -2989,7 +2989,7 @@
...
@@ -2989,7 +2989,7 @@
'
stopPropagation
'
:
_
.
noop
,
'
stopPropagation
'
:
_
.
noop
,
'
keyCode
'
:
13
// Enter
'
keyCode
'
:
13
// Enter
}
}
view
.
keyPressed
(
enter_event
);
view
.
onKeyDown
(
enter_event
);
const
msg
=
_converse
.
connection
.
send
.
calls
.
all
()[
0
].
args
[
0
];
const
msg
=
_converse
.
connection
.
send
.
calls
.
all
()[
0
].
args
[
0
];
expect
(
msg
.
toLocaleString
())
expect
(
msg
.
toLocaleString
())
...
...
spec/muc.js
View file @
e1762a1b
...
@@ -1962,7 +1962,7 @@
...
@@ -1962,7 +1962,7 @@
const
text
=
'
This is a sent message
'
;
const
text
=
'
This is a sent message
'
;
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea
.
value
=
text
;
textarea
.
value
=
text
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -2661,9 +2661,9 @@
...
@@ -2661,9 +2661,9 @@
textarea
.
value
=
'
/clear
'
;
textarea
.
value
=
'
/clear
'
;
const
enter
=
{
'
target
'
:
textarea
,
'
preventDefault
'
:
_
.
noop
,
'
keyCode
'
:
13
};
const
enter
=
{
'
target
'
:
textarea
,
'
preventDefault
'
:
_
.
noop
,
'
keyCode
'
:
13
};
view
.
keyPressed
(
enter
);
view
.
onKeyDown
(
enter
);
textarea
.
value
=
'
/help
'
;
textarea
.
value
=
'
/help
'
;
view
.
keyPressed
(
enter
);
view
.
onKeyDown
(
enter
);
let
info_messages
=
Array
.
prototype
.
slice
.
call
(
view
.
el
.
querySelectorAll
(
'
.chat-info
'
),
0
);
let
info_messages
=
Array
.
prototype
.
slice
.
call
(
view
.
el
.
querySelectorAll
(
'
.chat-info
'
),
0
);
expect
(
info_messages
.
length
).
toBe
(
19
);
expect
(
info_messages
.
length
).
toBe
(
19
);
...
@@ -2690,9 +2690,9 @@
...
@@ -2690,9 +2690,9 @@
const
occupant
=
view
.
model
.
occupants
.
findWhere
({
'
jid
'
:
_converse
.
bare_jid
});
const
occupant
=
view
.
model
.
occupants
.
findWhere
({
'
jid
'
:
_converse
.
bare_jid
});
occupant
.
set
(
'
affiliation
'
,
'
admin
'
);
occupant
.
set
(
'
affiliation
'
,
'
admin
'
);
textarea
.
value
=
'
/clear
'
;
textarea
.
value
=
'
/clear
'
;
view
.
keyPressed
(
enter
);
view
.
onKeyDown
(
enter
);
textarea
.
value
=
'
/help
'
;
textarea
.
value
=
'
/help
'
;
view
.
keyPressed
(
enter
);
view
.
onKeyDown
(
enter
);
info_messages
=
sizzle
(
'
.chat-info
'
,
view
.
el
).
slice
(
1
);
info_messages
=
sizzle
(
'
.chat-info
'
,
view
.
el
).
slice
(
1
);
expect
(
info_messages
.
length
).
toBe
(
17
);
expect
(
info_messages
.
length
).
toBe
(
17
);
let
commands
=
info_messages
.
map
(
m
=>
m
.
textContent
.
replace
(
/:.*$/
,
''
));
let
commands
=
info_messages
.
map
(
m
=>
m
.
textContent
.
replace
(
/:.*$/
,
''
));
...
@@ -2703,9 +2703,9 @@
...
@@ -2703,9 +2703,9 @@
]);
]);
occupant
.
set
(
'
affiliation
'
,
'
member
'
);
occupant
.
set
(
'
affiliation
'
,
'
member
'
);
textarea
.
value
=
'
/clear
'
;
textarea
.
value
=
'
/clear
'
;
view
.
keyPressed
(
enter
);
view
.
onKeyDown
(
enter
);
textarea
.
value
=
'
/help
'
;
textarea
.
value
=
'
/help
'
;
view
.
keyPressed
(
enter
);
view
.
onKeyDown
(
enter
);
info_messages
=
sizzle
(
'
.chat-info
'
,
view
.
el
).
slice
(
1
);
info_messages
=
sizzle
(
'
.chat-info
'
,
view
.
el
).
slice
(
1
);
expect
(
info_messages
.
length
).
toBe
(
10
);
expect
(
info_messages
.
length
).
toBe
(
10
);
commands
=
info_messages
.
map
(
m
=>
m
.
textContent
.
replace
(
/:.*$/
,
''
));
commands
=
info_messages
.
map
(
m
=>
m
.
textContent
.
replace
(
/:.*$/
,
''
));
...
@@ -2713,9 +2713,9 @@
...
@@ -2713,9 +2713,9 @@
occupant
.
set
(
'
role
'
,
'
participant
'
);
occupant
.
set
(
'
role
'
,
'
participant
'
);
textarea
.
value
=
'
/clear
'
;
textarea
.
value
=
'
/clear
'
;
view
.
keyPressed
(
enter
);
view
.
onKeyDown
(
enter
);
textarea
.
value
=
'
/help
'
;
textarea
.
value
=
'
/help
'
;
view
.
keyPressed
(
enter
);
view
.
onKeyDown
(
enter
);
info_messages
=
sizzle
(
'
.chat-info
'
,
view
.
el
).
slice
(
1
);
info_messages
=
sizzle
(
'
.chat-info
'
,
view
.
el
).
slice
(
1
);
expect
(
info_messages
.
length
).
toBe
(
7
);
expect
(
info_messages
.
length
).
toBe
(
7
);
commands
=
info_messages
.
map
(
m
=>
m
.
textContent
.
replace
(
/:.*$/
,
''
));
commands
=
info_messages
.
map
(
m
=>
m
.
textContent
.
replace
(
/:.*$/
,
''
));
...
@@ -2734,9 +2734,9 @@
...
@@ -2734,9 +2734,9 @@
const
enter
=
{
'
target
'
:
textarea
,
'
preventDefault
'
:
_
.
noop
,
'
keyCode
'
:
13
};
const
enter
=
{
'
target
'
:
textarea
,
'
preventDefault
'
:
_
.
noop
,
'
keyCode
'
:
13
};
spyOn
(
window
,
'
confirm
'
).
and
.
callFake
(()
=>
true
);
spyOn
(
window
,
'
confirm
'
).
and
.
callFake
(()
=>
true
);
textarea
.
value
=
'
/clear
'
;
textarea
.
value
=
'
/clear
'
;
view
.
keyPressed
(
enter
);
view
.
onKeyDown
(
enter
);
textarea
.
value
=
'
/help
'
;
textarea
.
value
=
'
/help
'
;
view
.
keyPressed
(
enter
);
view
.
onKeyDown
(
enter
);
const
info_messages
=
Array
.
prototype
.
slice
.
call
(
view
.
el
.
querySelectorAll
(
'
.chat-info
'
),
0
);
const
info_messages
=
Array
.
prototype
.
slice
.
call
(
view
.
el
.
querySelectorAll
(
'
.chat-info
'
),
0
);
expect
(
info_messages
.
length
).
toBe
(
17
);
expect
(
info_messages
.
length
).
toBe
(
17
);
...
@@ -2794,7 +2794,7 @@
...
@@ -2794,7 +2794,7 @@
// First check that an error message appears when a
// First check that an error message appears when a
// non-existent nick is used.
// non-existent nick is used.
textarea
.
value
=
'
/member chris Welcome to the club!
'
;
textarea
.
value
=
'
/member chris Welcome to the club!
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -2806,7 +2806,7 @@
...
@@ -2806,7 +2806,7 @@
// Now test with an existing nick
// Now test with an existing nick
textarea
.
value
=
'
/member marc Welcome to the club!
'
;
textarea
.
value
=
'
/member marc Welcome to the club!
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -2921,7 +2921,7 @@
...
@@ -2921,7 +2921,7 @@
// Check the alias /topic
// Check the alias /topic
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea
.
value
=
'
/topic This is the groupchat subject
'
;
textarea
.
value
=
'
/topic This is the groupchat subject
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -2931,7 +2931,7 @@
...
@@ -2931,7 +2931,7 @@
// Check /subject
// Check /subject
textarea
.
value
=
'
/subject This is a new subject
'
;
textarea
.
value
=
'
/subject This is a new subject
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -2945,7 +2945,7 @@
...
@@ -2945,7 +2945,7 @@
// Check case insensitivity
// Check case insensitivity
textarea
.
value
=
'
/Subject This is yet another subject
'
;
textarea
.
value
=
'
/Subject This is yet another subject
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -2968,7 +2968,7 @@
...
@@ -2968,7 +2968,7 @@
spyOn
(
view
,
'
clearMessages
'
);
spyOn
(
view
,
'
clearMessages
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
textarea
.
value
=
'
/clear
'
;
textarea
.
value
=
'
/clear
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -3010,7 +3010,7 @@
...
@@ -3010,7 +3010,7 @@
var
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
var
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
textarea
.
value
=
'
/owner
'
;
textarea
.
value
=
'
/owner
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -3098,7 +3098,7 @@
...
@@ -3098,7 +3098,7 @@
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
textarea
.
value
=
'
/ban
'
;
textarea
.
value
=
'
/ban
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -3178,7 +3178,7 @@
...
@@ -3178,7 +3178,7 @@
var
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
var
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
textarea
.
value
=
'
/kick
'
;
textarea
.
value
=
'
/kick
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -3279,7 +3279,7 @@
...
@@ -3279,7 +3279,7 @@
var
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
var
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
textarea
.
value
=
'
/op
'
;
textarea
.
value
=
'
/op
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -3421,7 +3421,7 @@
...
@@ -3421,7 +3421,7 @@
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
textarea
.
value
=
'
/mute
'
;
textarea
.
value
=
'
/mute
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
...
spec/omemo.js
View file @
e1762a1b
...
@@ -124,7 +124,7 @@
...
@@ -124,7 +124,7 @@
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea
.
value
=
'
This message will be encrypted
'
;
textarea
.
value
=
'
This message will be encrypted
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -309,7 +309,7 @@
...
@@ -309,7 +309,7 @@
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea
.
value
=
'
This message will be encrypted
'
;
textarea
.
value
=
'
This message will be encrypted
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -458,7 +458,7 @@
...
@@ -458,7 +458,7 @@
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea
.
value
=
'
This is an encrypted message from this device
'
;
textarea
.
value
=
'
This is an encrypted message from this device
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -515,7 +515,7 @@
...
@@ -515,7 +515,7 @@
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea
.
value
=
'
This message will be encrypted
'
;
textarea
.
value
=
'
This message will be encrypted
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
// Enter
keyCode
:
13
// Enter
...
@@ -1251,7 +1251,7 @@
...
@@ -1251,7 +1251,7 @@
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea
.
value
=
'
This message will be sent encrypted
'
;
textarea
.
value
=
'
This message will be sent encrypted
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
...
spec/room_registration.js
View file @
e1762a1b
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
view
=
_converse
.
chatboxviews
.
get
(
room_jid
);
view
=
_converse
.
chatboxviews
.
get
(
room_jid
);
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
)
textarea
.
value
=
'
/register
'
;
textarea
.
value
=
'
/register
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
...
spec/spoilers.js
View file @
e1762a1b
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea
.
value
=
'
This is the spoiler
'
;
textarea
.
value
=
'
This is the spoiler
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
@@ -187,7 +187,7 @@
...
@@ -187,7 +187,7 @@
const
hint_input
=
view
.
el
.
querySelector
(
'
.spoiler-hint
'
);
const
hint_input
=
view
.
el
.
querySelector
(
'
.spoiler-hint
'
);
hint_input
.
value
=
'
This is the hint
'
;
hint_input
.
value
=
'
This is the hint
'
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
textarea
,
target
:
textarea
,
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
...
src/converse-autocomplete.js
View file @
e1762a1b
...
@@ -279,7 +279,7 @@ converse.plugins.add("converse-autocomplete", {
...
@@ -279,7 +279,7 @@ converse.plugins.add("converse-autocomplete", {
}
}
}
}
keyPressed
(
ev
)
{
onKeyDown
(
ev
)
{
if
(
this
.
opened
)
{
if
(
this
.
opened
)
{
if
(
_
.
includes
([
_converse
.
keycodes
.
ENTER
,
_converse
.
keycodes
.
TAB
],
ev
.
keyCode
)
&&
this
.
selected
)
{
if
(
_
.
includes
([
_converse
.
keycodes
.
ENTER
,
_converse
.
keycodes
.
TAB
],
ev
.
keyCode
)
&&
this
.
selected
)
{
ev
.
preventDefault
();
ev
.
preventDefault
();
...
...
src/converse-chatview.js
View file @
e1762a1b
...
@@ -333,7 +333,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -333,7 +333,7 @@ converse.plugins.add('converse-chatview', {
'
click .toggle-smiley
'
:
'
toggleEmojiMenu
'
,
'
click .toggle-smiley
'
:
'
toggleEmojiMenu
'
,
'
click .upload-file
'
:
'
toggleFileUpload
'
,
'
click .upload-file
'
:
'
toggleFileUpload
'
,
'
input .chat-textarea
'
:
'
inputChanged
'
,
'
input .chat-textarea
'
:
'
inputChanged
'
,
'
keydown .chat-textarea
'
:
'
keyPressed
'
,
'
keydown .chat-textarea
'
:
'
onKeyDown
'
,
'
dragover .chat-textarea
'
:
'
onDragOver
'
,
'
dragover .chat-textarea
'
:
'
onDragOver
'
,
'
drop .chat-textarea
'
:
'
onDrop
'
,
'
drop .chat-textarea
'
:
'
onDrop
'
,
},
},
...
@@ -950,7 +950,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -950,7 +950,7 @@ converse.plugins.add('converse-chatview', {
this
.
setChatState
(
_converse
.
ACTIVE
,
{
'
silent
'
:
true
});
this
.
setChatState
(
_converse
.
ACTIVE
,
{
'
silent
'
:
true
});
},
},
keyPressed
(
ev
)
{
onKeyDown
(
ev
)
{
/* Event handler for when a key is pressed in a chat box textarea.
/* Event handler for when a key is pressed in a chat box textarea.
*/
*/
if
(
ev
.
ctrlKey
)
{
if
(
ev
.
ctrlKey
)
{
...
...
src/converse-headline.js
View file @
e1762a1b
...
@@ -76,7 +76,7 @@ converse.plugins.add('converse-headline', {
...
@@ -76,7 +76,7 @@ converse.plugins.add('converse-headline', {
events
:
{
events
:
{
'
click .close-chatbox-button
'
:
'
close
'
,
'
click .close-chatbox-button
'
:
'
close
'
,
'
click .toggle-chatbox-button
'
:
'
minimize
'
,
'
click .toggle-chatbox-button
'
:
'
minimize
'
,
'
keypress textarea.chat-textarea
'
:
'
keyPressed
'
'
keypress textarea.chat-textarea
'
:
'
onKeyDown
'
},
},
initialize
()
{
initialize
()
{
...
...
src/converse-muc-views.js
View file @
e1762a1b
...
@@ -524,8 +524,8 @@ converse.plugins.add('converse-muc-views', {
...
@@ -524,8 +524,8 @@ converse.plugins.add('converse-muc-views', {
'
click .toggle-smiley ul.emoji-picker li
'
:
'
insertEmoji
'
,
'
click .toggle-smiley ul.emoji-picker li
'
:
'
insertEmoji
'
,
'
click .toggle-smiley
'
:
'
toggleEmojiMenu
'
,
'
click .toggle-smiley
'
:
'
toggleEmojiMenu
'
,
'
click .upload-file
'
:
'
toggleFileUpload
'
,
'
click .upload-file
'
:
'
toggleFileUpload
'
,
'
keydown .chat-textarea
'
:
'
keyPressed
'
,
'
keydown .chat-textarea
'
:
'
onKeyDown
'
,
'
keyup .chat-textarea
'
:
'
k
eyUp
'
,
'
keyup .chat-textarea
'
:
'
onK
eyUp
'
,
'
input .chat-textarea
'
:
'
inputChanged
'
,
'
input .chat-textarea
'
:
'
inputChanged
'
,
'
dragover .chat-textarea
'
:
'
onDragOver
'
,
'
dragover .chat-textarea
'
:
'
onDragOver
'
,
'
drop .chat-textarea
'
:
'
onDrop
'
,
'
drop .chat-textarea
'
:
'
onDrop
'
,
...
@@ -641,14 +641,14 @@ converse.plugins.add('converse-muc-views', {
...
@@ -641,14 +641,14 @@ converse.plugins.add('converse-muc-views', {
this
.
mention_auto_complete
.
on
(
'
suggestion-box-selectcomplete
'
,
()
=>
(
this
.
auto_completing
=
false
));
this
.
mention_auto_complete
.
on
(
'
suggestion-box-selectcomplete
'
,
()
=>
(
this
.
auto_completing
=
false
));
},
},
keyPressed
(
ev
)
{
onKeyDown
(
ev
)
{
if
(
this
.
mention_auto_complete
.
keyPressed
(
ev
))
{
if
(
this
.
mention_auto_complete
.
onKeyDown
(
ev
))
{
return
;
return
;
}
}
return
_converse
.
ChatBoxView
.
prototype
.
keyPressed
.
apply
(
this
,
arguments
);
return
_converse
.
ChatBoxView
.
prototype
.
onKeyDown
.
apply
(
this
,
arguments
);
},
},
k
eyUp
(
ev
)
{
onK
eyUp
(
ev
)
{
this
.
mention_auto_complete
.
evaluate
(
ev
);
this
.
mention_auto_complete
.
evaluate
(
ev
);
},
},
...
...
tests/utils.js
View file @
e1762a1b
...
@@ -335,7 +335,7 @@
...
@@ -335,7 +335,7 @@
utils
.
sendMessage
=
function
(
view
,
message
)
{
utils
.
sendMessage
=
function
(
view
,
message
)
{
const
promise
=
new
Promise
((
resolve
,
reject
)
=>
view
.
on
(
'
messageInserted
'
,
resolve
));
const
promise
=
new
Promise
((
resolve
,
reject
)
=>
view
.
on
(
'
messageInserted
'
,
resolve
));
view
.
el
.
querySelector
(
'
.chat-textarea
'
).
value
=
message
;
view
.
el
.
querySelector
(
'
.chat-textarea
'
).
value
=
message
;
view
.
keyPressed
({
view
.
onKeyDown
({
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
preventDefault
:
_
.
noop
,
preventDefault
:
_
.
noop
,
keyCode
:
13
keyCode
:
13
...
...
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