emojione
Version:
EmojiOne is a complete set of emojis designed for the web. It includes libraries to easily convert unicode characters to shortnames (:smile:) and shortnames to our custom emoji images. PNG formats provided for the emoji images.
164 lines β’ 8.13 kB
JSON
{
"data": [
{
"module":"toImage",
"tests": [
{
"description": "test toImage",
"text": "Hello world! π :smile:",
"expected": "Hello world! <img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":smile:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\\\"/> <img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":smile:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\\\"/>"
},
{
"description": "mixed ascii, regular unicode and duplicate emoji",
"text": ":alien: is π½ and μ is not :alien: or :alien: also :randomy: is not emoji",
"expected": "<img class=\\\"emojione\\\" alt=\\\"π½\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> is <img class=\\\"emojione\\\" alt=\\\"π½\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> and μ is not <img class=\\\"emojione\\\" alt=\\\"π½\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> or <img class=\\\"emojione\\\" alt=\\\"π½\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> also :randomy: is not emoji"
}
]
},
{
"module":"unifyUnicode",
"tests": [
{
"description": "test unifyUnicode",
"text": "Hello world! π :smile:",
"expected": "Hello world! π π"
},
{
"description": "mixed ascii, regular unicode and duplicate emoji",
"text": ":alien: is π½ and μ is not :alien: or :alien: also :randomy: is not emoji",
"expected": "π½ is π½ and μ is not π½ or π½ also :randomy: is not emoji"
},
{
"description": "multiline emoji string",
"text": ":dancer:\\\n:dancer:",
"expected": "π\\\nπ"
},
{
"description": "triple emoji string",
"text": ":dancer::dancer::alien:",
"expected": "πππ½"
}
]
},
{
"module": "shortnameToUnicode",
"tests": [
{
"description": "single unicode character conversion",
"text": "Hello world! π :smile:",
"expected": "Hello world! π π"
},
{
"description": "shortname at start of sentence with apostrophe",
"text": ":snail:'s are cool!",
"expected": "π's are cool!"
},
{
"description": "shortname shares a colon",
"text": ":invalid:snail:",
"expected": ":invalidπ"
},
{
"description": "mixed ascii, regular unicode and duplicate emoji",
"text": ":alien: is π½ and μ is not :alien: or :alien: also :randomy: is not emoji",
"expected": "π½ is π½ and μ is not π½ or π½ also :randomy: is not emoji"
},
{
"description": "multiline emoji string",
"text": ":dancer:\\n:dancer:",
"expected": "π\\nπ"
},
{
"description": "triple emoji string",
"text": ":dancer::dancer::alien:",
"expected": "πππ½"
}
]
},
{
"module": "shortnameToImage",
"tests": [
{
"description": "single shortname character conversion",
"text": "Hello world! π :smile:",
"expected": "Hello world! π <img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":smile:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\\\"/>"
},
{
"description": "shortname at start of sentence with apostrophe",
"text": ":snail:'s are cool!",
"expected": "<img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":snail:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\\\"/>'s are cool!"
},
{
"description": "shortname shares a colon",
"text": ":invalid:snail:",
"expected": ":invalid<img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":snail:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\\\"/>"
},
{
"description": "mixed ascii, regular unicode and duplicate emoji",
"text": ":alien: is π½ and μ is not :alien: or :alien: also :randomy: is not emoji",
"expected": "<img class=\\\"emojione\\\" alt=\\\"π½\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> is π½ and μ is not <img class=\\\"emojione\\\" alt=\\\"π½\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> or <img class=\\\"emojione\\\" alt=\\\"π½\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> also :randomy: is not emoji"
},
{
"description": "multiline emoji string",
"text": ":dancer:\\n:dancer:",
"expected": "<img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":dancer:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\\\"/>\\n<img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":dancer:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\\\"/>"
},
{
"description": "triple emoji string",
"text": ":dancer::dancer::alien:",
"expected": "<img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":dancer:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\\\"/><img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":dancer:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\\\"/><img class=\\\"emojione\\\" alt=\\\"π½\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/>"
}
]
},
{
"module": "toShort",
"tests": [
{
"description": "single unicode character conversion",
"text": "Hello world! π :smile:",
"expected": "Hello world! :smile: :smile:"
},
{
"description": "mixed ascii, regular unicode and duplicate emoji",
"text": "π½ is not :alien: and μ is not π½ or π½",
"expected": ":alien: is not :alien: and μ is not :alien: or :alien:"
},
{
"description": "multiline emoji string",
"text": "π\\nπ",
"expected": ":dancer:\\n:dancer:"
},
{
"description": "alias vs. canonical",
"text": "π―π΅ γ©γγγγγγ¨γ",
"expected": ":flag_jp: γ©γγγγγγ¨γ"
},
{
"description": "unicode character conversion within excluded tag",
"text": "<div>π</div>",
"expected": "<div>:smile:</div>"
}
]
},
{
"module": "toImage",
"tests": [
{
"description": "single character shortname conversion",
"text": "Hello world! π :smile:",
"expected": "Hello world! <img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":smile:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\\\"/> <img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":smile:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\\\"/>"
},
{
"description": "shortname shares a colon",
"text": ":invalid:snail:",
"expected": ":invalid<img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":snail:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\\\"/>"
},
{
"description": "single unicode character conversion",
"text": "π",
"expected": "<img class=\\\"emojione\\\" alt=\\\"π\\\" title=\\\":snail:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\\\"/>"
}
]
}
]
}