1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-12-26 00:15:54 +00:00

added onerror option and test

This commit is contained in:
webreflection 2015-11-17 11:12:53 +00:00
parent e436f75780
commit f249ba9edd
7 changed files with 35 additions and 13 deletions

View File

@ -1,5 +1,5 @@
{
"version": "1.4.1",
"version": "1.4.2",
"name": "twemoji",
"license": ["MIT", "CC-BY-4.0"],
"description": "A Unicode standard based way to implement emoji across all platforms.",

18
test.js
View File

@ -535,4 +535,22 @@ wru.test([{
wru.assert('nothing to do here');
}
}
}, {
name: 'using a different onerror',
test: function () {
var Image = window.Image;
window.Image = function () {
var self = new Image;
setTimeout(function () {
window.Image = Image;
self.onerror();
}, 10);
return self;
};
var div = document.createElement('div');
div.innerHTML = '5\ufe0f\u20e3';
twemoji.parse(div, {onerror: wru.async(function () {
wru.assert('OK');
})});
}
}]);

View File

@ -664,7 +664,7 @@ function createTwemoji(re) {
);
if (src) {
img = new Image();
img.onerror = twemoji.onerror;
img.onerror = options.onerror;
img.setAttribute('draggable', 'false');
attrib = options.attributes(icon, variant);
for (attrname in attrib) {
@ -828,7 +828,8 @@ function createTwemoji(re) {
base: typeof how.base === 'string' ? how.base : twemoji.base,
ext: how.ext || twemoji.ext,
size: how.folder || toSizeSquaredAsset(how.size || twemoji.size),
className: how.className || twemoji.className
className: how.className || twemoji.className,
onerror: how.onerror || twemoji.onerror
});
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
twemoji.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long