diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js index 644b2f2134..154661f752 100644 --- a/frontend_tests/node_tests/compose.js +++ b/frontend_tests/node_tests/compose.js @@ -321,6 +321,14 @@ people.add(bob); compose.handle_keydown(event); assert.equal("****Anything **bold**.", $('#compose-textarea').val()); + // Test 'i' is typed correctly. + $("#compose-textarea").val('i'); + event.keyCode = undefined; + event.which = 73; + event.metaKey = false; + event.ctrlKey = false; + compose.handle_keydown(event); + assert.equal("i", $('#compose-textarea').val()); // Test italic: ctrl/cmd + i. input_text = "Anything italic"; $("#compose-textarea").val(input_text); diff --git a/static/js/compose.js b/static/js/compose.js index f903fa88b9..a94167c10c 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -679,7 +679,7 @@ exports.handle_keydown = function (event) { var isItalic = code === 73 && !event.shiftKey; var isLink = code === 76 && event.shiftKey; - if (isBold || isItalic || isLink && (event.ctrlKey || event.metaKey)) { + if ((isBold || isItalic || isLink) && (event.ctrlKey || event.metaKey)) { function add_markdown(markdown) { var textarea = $("#compose-textarea"); var range = textarea.range();