allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [4/7] allura git commit: [#6923] Add test cases for emoji extension
Date Tue, 23 Oct 2018 20:11:07 GMT
[#6923] Add test cases for emoji extension


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/bebfa239
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/bebfa239
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/bebfa239

Branch: refs/heads/master
Commit: bebfa239d8a72832952a98e69f503fe51d8a0dbf
Parents: 9bb9f99
Author: Shalitha Suranga <shalithasuranga@gmail.com>
Authored: Tue Oct 23 11:59:13 2018 +0530
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Tue Oct 23 19:56:51 2018 +0000

----------------------------------------------------------------------
 Allura/allura/tests/test_globals.py | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/bebfa239/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index caf9ab4..470286c 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -750,6 +750,34 @@ class TestCachedMarkdown(unittest.TestCase):
         self.assertEqual(required_keys, keys)
 
 
+class TestEmojis(unittest.TestCase):
+
+    def test_markdown_emoji_atomic(self):
+        output = g.markdown.convert(':+1:')
+        assert u'<p>\U0001F44D</p>' in output
+        output = g.markdown.convert(':Bosnia_&_Herzegovina:')
+        assert u'<p>\U0001F1E7\U0001F1E6</p>' in output
+        output = g.markdown.convert(':+1:')
+        assert u'<p>\U0001F44D</p>' in output
+        output = g.markdown.convert(u':Åland_Islands:') # emoji code with non-asciii charactor
+        assert u'<p>\U0001F1E6\U0001F1FD</p>' in output
+
+    def test_markdown_emoji_with_text(self):
+        output = g.markdown.convert('Thumbs up emoji :+1: wow!')
+        assert u'<p>Thumbs up emoji \U0001F44D wow!</p>' in output
+        output = g.markdown.convert(u'More emojis :+1::camel::three_o’clock: wow!')
+        assert u'<p>More emojis \U0001F44D\U0001F42B\U0001F552 wow!</p>' in output
+        output = g.markdown.convert(':man_bouncing_ball_medium-light_skin_tone:emoji:+1:')
+        assert u'<p>\U000026F9\U0001F3FC\U0000200D\U00002642\U0000FE0Femoji\U0001F44D</p>'
in output
+
+    def test_markdown_emoji_in_code(self):
+        output = g.markdown.convert('This will not become an emoji `:+1:`')
+        assert u'<p>This will not become an emoji <code>:+1:</code></p>'
in output
+        output = g.markdown.convert(u'```html\n<p>:Curaçao:</p>\n```')
+        assert u':Curaçao:' in output
+        output = g.markdown.convert(u'~~~\n:Curaçao:\n~~~')
+        assert u':Curaçao:' in output
+
 class TestHandlePaging(unittest.TestCase):
 
     def setUp(self):


Mime
View raw message