mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: emoji unescape
This commit is contained in:
@@ -52,7 +52,7 @@ test('spoiler', function() {
|
||||
format("[spoiler]it's a sled[/spoiler]", "<span class=\"spoiler\">it's a sled</span>", "supports spoiler tags on text");
|
||||
format("[spoiler]<img src='http://eviltrout.com/eviltrout.png' width='50' height='50'>[/spoiler]",
|
||||
"<span class=\"spoiler\"><img src=\"http://eviltrout.com/eviltrout.png\" width=\"50\" height=\"50\"></span>", "supports spoiler tags on images");
|
||||
format("[spoiler] This is the **bold** :smiley: [/spoiler]", "<span class=\"spoiler\"> This is the <strong>bold</strong> <img src=\"/images/emoji/undefined/smiley.png?v=0\" title=\":smiley:\" class=\"emoji\" alt=\"smiley\"> </span>", "supports spoiler tags on emojis");
|
||||
format("[spoiler] This is the **bold** :smiley: [/spoiler]", "<span class=\"spoiler\"> This is the <strong>bold</strong> <img src=\"/images/emoji/emoji_one/smiley.png?v=0\" title=\":smiley:\" class=\"emoji\" alt=\"smiley\"> </span>", "supports spoiler tags on emojis");
|
||||
format("[spoiler] Why not both <img src='http://eviltrout.com/eviltrout.png' width='50' height='50'>?[/spoiler]", "<span class=\"spoiler\"> Why not both <img src=\"http://eviltrout.com/eviltrout.png\" width=\"50\" height=\"50\">?</span>", "supports images and text");
|
||||
format("In a p tag a spoiler [spoiler] <img src='http://eviltrout.com/eviltrout.png' width='50' height='50'>[/spoiler] can work.", "In a p tag a spoiler <span class=\"spoiler\"> <img src=\"http://eviltrout.com/eviltrout.png\" width=\"50\" height=\"50\"></span> can work.", "supports images and text in a p tag");
|
||||
});
|
||||
|
||||
@@ -1,10 +1,29 @@
|
||||
|
||||
module('emoji');
|
||||
|
||||
var testUnescape = function(input, expected, description) {
|
||||
var unescaped = Discourse.Emoji.unescape(input);
|
||||
equal(unescaped, expected, description);
|
||||
};
|
||||
|
||||
test("Emoji.unescape", function(){
|
||||
|
||||
testUnescape("Not emoji :O) :frog) :smile)", "Not emoji :O) :frog) :smile)", "title without emoji");
|
||||
testUnescape("Not emoji :frog :smile", "Not emoji :frog :smile", "end colon is not optional");
|
||||
testUnescape("emoticons :)", "emoticons <img src='/images/emoji/emoji_one/smile.png?v=0' title='smile' alt='smile' class='emoji'>", "emoticons are still supported");
|
||||
testUnescape("With emoji :O: :frog: :smile:",
|
||||
"With emoji <img src='/images/emoji/emoji_one/o.png?v=0' title='O' alt='O' class='emoji'> <img src='/images/emoji/emoji_one/frog.png?v=0' title='frog' alt='frog' class='emoji'> <img src='/images/emoji/emoji_one/smile.png?v=0' title='smile' alt='smile' class='emoji'>",
|
||||
"title with emoji");
|
||||
testUnescape("a:smile:a", "a:smile:a", "word characters not allowed next to emoji");
|
||||
testUnescape("(:frog:) :)", "(<img src='/images/emoji/emoji_one/frog.png?v=0' title='frog' alt='frog' class='emoji'>) <img src='/images/emoji/emoji_one/smile.png?v=0' title='smile' alt='smile' class='emoji'>", "non-word characters allowed next to emoji");
|
||||
testUnescape(":smile: hi", "<img src='/images/emoji/emoji_one/smile.png?v=0' title='smile' alt='smile' class='emoji'> hi", "start of line");
|
||||
testUnescape("hi :smile:", "hi <img src='/images/emoji/emoji_one/smile.png?v=0' title='smile' alt='smile' class='emoji'>", "end of line");
|
||||
|
||||
});
|
||||
|
||||
test("Emoji.search", function(){
|
||||
|
||||
// able to find an alias
|
||||
equal(Discourse.Emoji.search("coll").length, 1);
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user