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
", "emoticons are still supported");
testUnescape("With emoji :O: :frog: :smile:",
"With emoji
",
"title with emoji");
testUnescape("a:smile:a", "a:smile:a", "word characters not allowed next to emoji");
testUnescape("(:frog:) :)", "(
)
", "non-word characters allowed next to emoji");
testUnescape(":smile: hi", "
hi", "start of line");
testUnescape("hi :smile:", "hi
", "end of line");
});
test("Emoji.search", function(){
// able to find an alias
equal(Discourse.Emoji.search("coll").length, 1);
});