Seditio Source
Root |
./othercms/xenForo 2.2.8/src/vendor/joypixels/emoji-toolkit/lib/js/tests/tests.html
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/qunit/1.14.0/qunit.css" type="text/css" media="screen" />
    </head>
    <body>
        <div id="qunit"></div>
        <div id="qunit-fixture"></div>
        <script src="http://cdn.jsdelivr.net/qunit/1.14.0/qunit.js"></script>
        <script src="../joypixels.js"></script>
        <script>
       
            QUnit.module("toImage");
           
                QUnit.test( "test toImage", function( assert ) {
                    assert.equal(joypixels.toImage("Hello world! πŸ˜„ :smile:"), "Hello world! <img class=\"joypixels\" alt=\"πŸ˜„\" title=\":smile:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f604.png\"/> <img class=\"joypixels\" alt=\"πŸ˜„\" title=\":smile:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f604.png\"/>");
                });
           
                QUnit.test( "mixed ascii, regular unicode and duplicate emoji", function( assert ) {
                    assert.equal(joypixels.toImage(":alien: is πŸ‘½ and μ € is not :alien: or :alien: also :randomy: is not emoji"), "<img class=\"joypixels\" alt=\"πŸ‘½\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f47d.png\"/> is <img class=\"joypixels\" alt=\"πŸ‘½\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f47d.png\"/> and μ € is not <img class=\"joypixels\" alt=\"πŸ‘½\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f47d.png\"/> or <img class=\"joypixels\" alt=\"πŸ‘½\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f47d.png\"/> also :randomy: is not emoji");
                });
           
       
            QUnit.module("unifyUnicode");
           
                QUnit.test( "test unifyUnicode", function( assert ) {
                    assert.equal(joypixels.unifyUnicode("Hello world! πŸ˜„ :smile:"), "Hello world! πŸ˜„ πŸ˜„");
                });
           
                QUnit.test( "mixed ascii, regular unicode and duplicate emoji", function( assert ) {
                    assert.equal(joypixels.unifyUnicode(":alien: is πŸ‘½ and μ € is not :alien: or :alien: also :randomy: is not emoji"), "πŸ‘½ is πŸ‘½ and μ € is not πŸ‘½ or πŸ‘½ also :randomy: is not emoji");
                });
           
                QUnit.test( "multiline emoji string", function( assert ) {
                    assert.equal(joypixels.unifyUnicode(":dancer:\
:dancer:"), "πŸ’ƒ\
πŸ’ƒ");
                });
           
                QUnit.test( "triple emoji string", function( assert ) {
                    assert.equal(joypixels.unifyUnicode(":dancer::dancer::alien:"), "πŸ’ƒπŸ’ƒπŸ‘½");
                });
           
       
            QUnit.module("shortnameToUnicode");
           
                QUnit.test( "single unicode character conversion", function( assert ) {
                    assert.equal(joypixels.shortnameToUnicode("Hello world! πŸ˜„ :smile:"), "Hello world! πŸ˜„ πŸ˜„");
                });
           
                QUnit.test( "shortname at start of sentence with apostrophe", function( assert ) {
                    assert.equal(joypixels.shortnameToUnicode(":snail:'s are cool!"), "🐌's are cool!");
                });
           
                QUnit.test( "shortname shares a colon", function( assert ) {
                    assert.equal(joypixels.shortnameToUnicode(":invalid:snail:"), ":invalid🐌");
                });
           
                QUnit.test( "mixed ascii, regular unicode and duplicate emoji", function( assert ) {
                    assert.equal(joypixels.shortnameToUnicode(":alien: is πŸ‘½ and μ € is not :alien: or :alien: also :randomy: is not emoji"), "πŸ‘½ is πŸ‘½ and μ € is not πŸ‘½ or πŸ‘½ also :randomy: is not emoji");
                });
           
                QUnit.test( "multiline emoji string", function( assert ) {
                    assert.equal(joypixels.shortnameToUnicode(":dancer:\n:dancer:"), "πŸ’ƒ\nπŸ’ƒ");
                });
           
                QUnit.test( "triple emoji string", function( assert ) {
                    assert.equal(joypixels.shortnameToUnicode(":dancer::dancer::alien:"), "πŸ’ƒπŸ’ƒπŸ‘½");
                });
           
       
            QUnit.module("shortnameToImage");
           
                QUnit.test( "single shortname character conversion", function( assert ) {
                    assert.equal(joypixels.shortnameToImage("Hello world! πŸ˜„ :smile:"), "Hello world! πŸ˜„ <img class=\"joypixels\" alt=\"πŸ˜„\" title=\":smile:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f604.png\"/>");
                });
           
                QUnit.test( "shortname at start of sentence with apostrophe", function( assert ) {
                    assert.equal(joypixels.shortnameToImage(":snail:'s are cool!"), "<img class=\"joypixels\" alt=\"🐌\" title=\":snail:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f40c.png\"/>'s are cool!");
                });
           
                QUnit.test( "shortname shares a colon", function( assert ) {
                    assert.equal(joypixels.shortnameToImage(":invalid:snail:"), ":invalid<img class=\"joypixels\" alt=\"🐌\" title=\":snail:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f40c.png\"/>");
                });
           
                QUnit.test( "mixed ascii, regular unicode and duplicate emoji", function( assert ) {
                    assert.equal(joypixels.shortnameToImage(":alien: is πŸ‘½ and μ € is not :alien: or :alien: also :randomy: is not emoji"), "<img class=\"joypixels\" alt=\"πŸ‘½\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f47d.png\"/> is πŸ‘½ and μ € is not <img class=\"joypixels\" alt=\"πŸ‘½\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f47d.png\"/> or <img class=\"joypixels\" alt=\"πŸ‘½\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f47d.png\"/> also :randomy: is not emoji");
                });
           
                QUnit.test( "multiline emoji string", function( assert ) {
                    assert.equal(joypixels.shortnameToImage(":dancer:\n:dancer:"), "<img class=\"joypixels\" alt=\"πŸ’ƒ\" title=\":dancer:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f483.png\"/>\n<img class=\"joypixels\" alt=\"πŸ’ƒ\" title=\":dancer:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f483.png\"/>");
                });
           
                QUnit.test( "triple emoji string", function( assert ) {
                    assert.equal(joypixels.shortnameToImage(":dancer::dancer::alien:"), "<img class=\"joypixels\" alt=\"πŸ’ƒ\" title=\":dancer:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f483.png\"/><img class=\"joypixels\" alt=\"πŸ’ƒ\" title=\":dancer:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f483.png\"/><img class=\"joypixels\" alt=\"πŸ‘½\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f47d.png\"/>");
                });
           
       
            QUnit.module("toShort");
           
                QUnit.test( "single unicode character conversion", function( assert ) {
                    assert.equal(joypixels.toShort("Hello world! πŸ˜„ :smile:"), "Hello world! :smile: :smile:");
                });
           
                QUnit.test( "mixed ascii, regular unicode and duplicate emoji", function( assert ) {
                    assert.equal(joypixels.toShort("πŸ‘½ is not :alien: and μ € is not πŸ‘½ or πŸ‘½"), ":alien: is not :alien: and μ € is not :alien: or :alien:");
                });
           
                QUnit.test( "multiline emoji string", function( assert ) {
                    assert.equal(joypixels.toShort("πŸ’ƒ\nπŸ’ƒ"), ":dancer:\n:dancer:");
                });
           
                QUnit.test( "alias vs. canonical", function( assert ) {
                    assert.equal(joypixels.toShort("πŸ‡―πŸ‡΅ γ©γ†γ‚‚γ‚γ‚ŠγŒγ¨γ†"), ":flag_jp: γ©γ†γ‚‚γ‚γ‚ŠγŒγ¨γ†");
                });
           
                QUnit.test( "unicode character conversion within excluded tag", function( assert ) {
                    assert.equal(joypixels.toShort("<div>πŸ˜„</div>"), "<div>:smile:</div>");
                });
           
       
            QUnit.module("toImage");
           
                QUnit.test( "single character shortname conversion", function( assert ) {
                    assert.equal(joypixels.toImage("Hello world! πŸ˜„ :smile:"), "Hello world! <img class=\"joypixels\" alt=\"πŸ˜„\" title=\":smile:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f604.png\"/> <img class=\"joypixels\" alt=\"πŸ˜„\" title=\":smile:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f604.png\"/>");
                });
           
                QUnit.test( "shortname shares a colon", function( assert ) {
                    assert.equal(joypixels.toImage(":invalid:snail:"), ":invalid<img class=\"joypixels\" alt=\"🐌\" title=\":snail:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f40c.png\"/>");
                });
           
                QUnit.test( "single unicode character conversion", function( assert ) {
                    assert.equal(joypixels.toImage("🐌"), "<img class=\"joypixels\" alt=\"🐌\" title=\":snail:\" src=\"https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f40c.png\"/>");
                });
           
       
        </script>
    </body>
</html>