Skip to content

Commit

Permalink
build new js tests, update php regex client for 15.1
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyahenson committed Jul 21, 2024
1 parent 8f6ef2a commit 5af2c5f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/js/joypixels.min.js

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions lib/js/tests/tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
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/8.0/png/unicode/32/1f604.png"/> <img class="joypixels" alt="πŸ˜„" title=":smile:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/32/1f604.png"/>');
assert.equal(joypixels.toImage("Hello world! πŸ˜„ :smile:"), 'Hello world! <img class="joypixels" alt="πŸ˜„" title=":smile:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/1f604.png"/> <img class="joypixels" alt="πŸ˜„" title=":smile:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/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/8.0/png/unicode/32/1f47d.png"/> is <img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/32/1f47d.png"/> and μ € is not <img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/32/1f47d.png"/> or <img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/32/1f47d.png"/> also :randomy: is not emoji');
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/9.0/png/unicode/32/1f47d.png"/> is <img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/1f47d.png"/> and μ € is not <img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/1f47d.png"/> or <img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/1f47d.png"/> also :randomy: is not emoji');
});


Expand Down Expand Up @@ -73,27 +73,27 @@
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/8.0/png/unicode/32/1f604.png"/>');
assert.equal(joypixels.shortnameToImage("Hello world! πŸ˜„ :smile:"), 'Hello world! πŸ˜„ <img class="joypixels" alt="πŸ˜„" title=":smile:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/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/8.0/png/unicode/32/1f40c.png"/>\'s are cool!');
assert.equal(joypixels.shortnameToImage(":snail:'s are cool!"), '<img class="joypixels" alt="🐌" title=":snail:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/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/8.0/png/unicode/32/1f40c.png"/>');
assert.equal(joypixels.shortnameToImage(":invalid:snail:"), ':invalid<img class="joypixels" alt="🐌" title=":snail:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/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/8.0/png/unicode/32/1f47d.png"/> is πŸ‘½ and μ € is not <img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/32/1f47d.png"/> or <img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/32/1f47d.png"/> also :randomy: is not emoji');
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/9.0/png/unicode/32/1f47d.png"/> is πŸ‘½ and μ € is not <img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/1f47d.png"/> or <img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/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/8.0/png/unicode/32/1f483.png"/>\n<img class="joypixels" alt="πŸ’ƒ" title=":dancer:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/32/1f483.png"/>');
assert.equal(joypixels.shortnameToImage(":dancer:\n:dancer:"), '<img class="joypixels" alt="πŸ’ƒ" title=":dancer:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/1f483.png"/>\n<img class="joypixels" alt="πŸ’ƒ" title=":dancer:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/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/8.0/png/unicode/32/1f483.png"/><img class="joypixels" alt="πŸ’ƒ" title=":dancer:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/32/1f483.png"/><img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/32/1f47d.png"/>');
assert.equal(joypixels.shortnameToImage(":dancer::dancer::alien:"), '<img class="joypixels" alt="πŸ’ƒ" title=":dancer:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/1f483.png"/><img class="joypixels" alt="πŸ’ƒ" title=":dancer:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/1f483.png"/><img class="joypixels" alt="πŸ‘½" title=":alien:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/1f47d.png"/>');
});


Expand Down Expand Up @@ -123,15 +123,15 @@
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/8.0/png/unicode/32/1f604.png"/> <img class="joypixels" alt="πŸ˜„" title=":smile:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/32/1f604.png"/>');
assert.equal(joypixels.toImage("Hello world! πŸ˜„ :smile:"), 'Hello world! <img class="joypixels" alt="πŸ˜„" title=":smile:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/1f604.png"/> <img class="joypixels" alt="πŸ˜„" title=":smile:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/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/8.0/png/unicode/32/1f40c.png"/>');
assert.equal(joypixels.toImage(":invalid:snail:"), ':invalid<img class="joypixels" alt="🐌" title=":snail:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/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/8.0/png/unicode/32/1f40c.png"/>');
assert.equal(joypixels.toImage("🐌"), '<img class="joypixels" alt="🐌" title=":snail:" src="https://cdn.jsdelivr.net/joypixels/assets/9.0/png/unicode/32/1f40c.png"/>');
});


Expand Down
Loading

0 comments on commit 5af2c5f

Please sign in to comment.