REFACTOR: Migrate markdown functionality in ES6

This commit is contained in:
Robin Ward
2016-06-14 14:31:51 -04:00
parent bc25d9a7a0
commit a546395397
146 changed files with 3259 additions and 5675 deletions

View File

@ -1,15 +1,13 @@
import { emojiSearch, IMAGE_VERSION as v } from 'pretty-text/emoji';
import { emojiUnescape } from 'discourse/lib/text';
module('emoji');
module('lib:emoji');
var testUnescape = function(input, expected, description) {
var unescaped = Discourse.Emoji.unescape(input);
equal(unescaped, expected, description);
function testUnescape(input, expected, description) {
equal(emojiUnescape(input), expected, description);
};
test("Emoji.unescape", function(){
const v = Discourse.Emoji.ImageVersion;
test("emojiUnescape", () => {
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/slight_smile.png?v=2' title='slight_smile' alt='slight_smile' class='emoji'>", "emoticons are still supported");
@ -23,12 +21,12 @@ test("Emoji.unescape", function(){
});
test("Emoji.search", function(){
test("Emoji search", () => {
// able to find an alias
equal(Discourse.Emoji.search("+1").length, 1);
equal(emojiSearch("+1").length, 1);
// able to find middle of line search
equal(Discourse.Emoji.search("check", {maxResults: 3}).length, 3);
equal(emojiSearch("check", {maxResults: 3}).length, 3);
});