diff --git a/frontend_tests/node_tests/composebox_typeahead.js b/frontend_tests/node_tests/composebox_typeahead.js index 2f7a794868..864acfea6e 100644 --- a/frontend_tests/node_tests/composebox_typeahead.js +++ b/frontend_tests/node_tests/composebox_typeahead.js @@ -983,10 +983,12 @@ run_test('begins_typeahead', () => { assert_typeahead_equals(" :", false); assert_typeahead_equals(":)", false); assert_typeahead_equals(":4", false); + assert_typeahead_equals(": la", false); assert_typeahead_equals("test :-P", false); assert_typeahead_equals("hi emoji :", false); assert_typeahead_equals("hi emoj:i", false); assert_typeahead_equals("hi emoji :D", false); + assert_typeahead_equals("hi emoji : t", false); assert_typeahead_equals("hi emoji :t", emoji_list); assert_typeahead_equals("hi emoji :ta", emoji_list); assert_typeahead_equals("hi emoji :da", emoji_list); diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js index 08ab94247a..b313398f9b 100644 --- a/static/js/composebox_typeahead.js +++ b/static/js/composebox_typeahead.js @@ -351,6 +351,10 @@ exports.compose_content_begins_typeahead = function (query) { if (/^:-.?$/.test(current_token) || /^:[^a-z+]?$/.test(current_token)) { return false; } + // Don't autocomplete if there is a space following a ':' + if (current_token[1] === " ") { + return false; + } this.completing = 'emoji'; this.token = current_token.substring(1); return emoji.emojis;