summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-03-02 08:42:28 -0500
committerJoram Wilander <jwawilander@gmail.com>2017-03-02 08:42:28 -0500
commit991925b7ee5ddfc45cc28943ea4e9ce68025438a (patch)
tree5b616441c923f58e6ad98646ac41229fbb5b7d66 /webapp
parentea10b63ae41afe748e256d0ffb5c3e003a04d625 (diff)
downloadchat-991925b7ee5ddfc45cc28943ea4e9ce68025438a.tar.gz
chat-991925b7ee5ddfc45cc28943ea4e9ce68025438a.tar.bz2
chat-991925b7ee5ddfc45cc28943ea4e9ce68025438a.zip
Added unit tests for mentions inside of hashtags (#5577)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/tests/formatting_hashtags.test.jsx45
1 files changed, 45 insertions, 0 deletions
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(),
+ '<p>#@test</p>'
+ );
+
+ let options = {
+ usernameMap: {
+ test: {id: '1234', username: 'test'}
+ }
+ };
+ assert.equal(
+ TextFormatting.formatText('#@test', options).trim(),
+ "<p>#<a class='mention-link' href='#' data-mention='test'>@test</a></p>"
+ );
+
+ assert.equal(
+ TextFormatting.formatText('#~test').trim(),
+ '<p>#~test</p>'
+ );
+
+ 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(),
+ '<p>#~test</p>'
+ );
+
+ assert.equal(
+ TextFormatting.formatText('#:taco:').trim(),
+ '<p>#<span alt=":taco:" class="emoticon" title=":taco:" style="background-image:url(/static/emoji/taco.png)"></span></p>'
+ );
+
+ assert.equal(
+ TextFormatting.formatText('#test@example.com').trim(),
+ "<p><a class='mention-link' href='#' data-hashtag='#test'>#test</a>@example.com</p>"
+ );
+
+ done();
+ });
});