diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.js index e8e3852170..db095bd9d2 100644 --- a/frontend_tests/node_tests/markdown.js +++ b/frontend_tests/node_tests/markdown.js @@ -292,6 +292,12 @@ var bugdown_data = JSON.parse(fs.readFileSync(path.join(__dirname, '../../zerver expected: '

@*notagroup*

'}, {input: 'This is a realm filter `hello` with text after it', expected: '

This is a realm filter hello with text after it

'}, + // Test the emoticon conversion + {input: ':)', + expected: '

:)

'}, + {input: ':)', + expected: '

:smiley:

', + translate_emoticons: true}, ]; // We remove one of the unicode emoji we put as input in one of the test @@ -300,6 +306,9 @@ var bugdown_data = JSON.parse(fs.readFileSync(path.join(__dirname, '../../zerver delete emoji_codes.codepoint_to_name['1f6b2']; test_cases.forEach(function (test_case) { + // Disable emoji conversion by default. + page_params.translate_emoticons = test_case.translate_emoticons || false; + var input = test_case.input; var expected = test_case.expected; @@ -309,17 +318,6 @@ var bugdown_data = JSON.parse(fs.readFileSync(path.join(__dirname, '../../zerver assert.equal(expected, output); }); - - // Here to arrange 100% test coverage for the new emoticons code - // path. TODO: Have a better way to test this setting in both - // states, once we implement the local echo feature properly. - // Probably a good technique would be to support toggling the - // page_params setting inside the `test_cases.forEach` loop above. - page_params.translate_emoticons = true; - var message = {raw_content: ":)"}; - markdown.apply_markdown(message); - assert.equal('

:smiley:

', message.content); - page_params.translate_emoticons = false; }()); (function test_subject_links() {