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