From 3fe5a99692b4f2b7caeb1125947cabb1ec9e6794 Mon Sep 17 00:00:00 2001 From: Tom Wuttke Date: Tue, 1 Mar 2016 12:22:52 -0800 Subject: [PATCH] add tests for asterisk keycap variant --- 2/test/test.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/2/test/test.js b/2/test/test.js index 6a7d022f..6d43e8b7 100644 --- a/2/test/test.js +++ b/2/test/test.js @@ -478,6 +478,36 @@ wru.test([{ wru.assert('the length is preserved', div.getElementsByTagName('img')[0].alt.length === 2); } +},{ + name: 'non standard OSX asterisk keycap variant', + test: function () { + var div = document.createElement('div'); + div.innerHTML = '*\ufe0f\u20e3'; + twemoji.parse(div); + wru.assert('recognized as graphical', + div.firstChild.className === 'emoji' && + div.firstChild.getAttribute('draggable') === 'false' && + div.firstChild.getAttribute('alt') === '*\ufe0f\u20e3' && + div.firstChild.src === 'https://twemoji.maxcdn.com/2/72x72/2a-20e3.png' + ); + wru.assert('the length is preserved', + div.getElementsByTagName('img')[0].alt.length === 3); + } +},{ + name: 'same but standard asterisk keycap without variant', + test: function () { + var div = document.createElement('div'); + div.innerHTML = '*\u20e3'; + twemoji.parse(div); + wru.assert('recognized as graphical', + div.firstChild.className === 'emoji' && + div.firstChild.getAttribute('draggable') === 'false' && + div.firstChild.getAttribute('alt') === '*\u20e3' && + div.firstChild.src === 'https://twemoji.maxcdn.com/2/72x72/2a-20e3.png' + ); + wru.assert('the length is preserved', + div.getElementsByTagName('img')[0].alt.length === 2); + } }, { name: 'multiple parsing using a callback', test: function () {