From 991925b7ee5ddfc45cc28943ea4e9ce68025438a Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 2 Mar 2017 08:42:28 -0500 Subject: Added unit tests for mentions inside of hashtags (#5577) --- webapp/tests/formatting_hashtags.test.jsx | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'webapp') diff --git a/webapp/tests/formatting_hashtags.test.jsx b/webapp/tests/formatting_hashtags.test.jsx index 1c7de1541..657dcf69d 100644 --- a/webapp/tests/formatting_hashtags.test.jsx +++ b/webapp/tests/formatting_hashtags.test.jsx @@ -154,4 +154,49 @@ describe('TextFormatting.Hashtags', function() { done(); }); + + it('Potential hashtags with other entities nested', function(done) { + assert.equal( + TextFormatting.formatText('#@test').trim(), + '

#@test

' + ); + + let options = { + usernameMap: { + test: {id: '1234', username: 'test'} + } + }; + assert.equal( + TextFormatting.formatText('#@test', options).trim(), + "

#@test

" + ); + + assert.equal( + TextFormatting.formatText('#~test').trim(), + '

#~test

' + ); + + options = { + channelNamesMap: { + test: {id: '1234', name: 'test', display_name: 'Test Channel'} + }, + team: {id: 'abcd', name: 'abcd', display_name: 'Alphabet'} + }; + assert.equal( + TextFormatting.formatText('#~test', options).trim(), + '

#~test

' + ); + + assert.equal( + TextFormatting.formatText('#:taco:').trim(), + '

#

' + ); + + assert.equal( + TextFormatting.formatText('#test@example.com').trim(), + "

#test@example.com

" + ); + + done(); + }); }); -- cgit v1.2.3-1-g7c22