mirror of
https://github.com/twitter/twemoji.git
synced 2024-06-15 03:35:16 +00:00
fixed test assertions
This commit is contained in:
parent
90834d4481
commit
943bdd6e05
22
test.js
22
test.js
@ -364,7 +364,7 @@ wru.test([{
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
name: 'DOM parsing + attributes callback',
|
name: 'DOM parsing + attributes callback',
|
||||||
test: function () {
|
test: function () {
|
||||||
var img,
|
var img,
|
||||||
@ -372,18 +372,18 @@ wru.test([{
|
|||||||
div = document.createElement('div');
|
div = document.createElement('div');
|
||||||
div.appendChild(document.createTextNode('I \u2764 emoji!'));
|
div.appendChild(document.createTextNode('I \u2764 emoji!'));
|
||||||
twemoji.parse(
|
twemoji.parse(
|
||||||
div, {
|
div, {
|
||||||
attributes: function(icon) {
|
attributes: function(icon) {
|
||||||
return {
|
return {
|
||||||
title: 'Emoji: ' + icon,
|
title: 'Emoji: ' + icon,
|
||||||
'data-test': 'We all <3 emoji',
|
'data-test': 'We all <3 emoji',
|
||||||
onclick: 'nope',
|
onclick: 'nope',
|
||||||
onmousedown: 'nada'
|
onmousedown: 'nada'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
wru.assert('default parsing works creating 3 nodes', div.childNodes.length === 3);
|
wru.assert('default parsing works creating 3 nodes', div.childNodes.length === 3);
|
||||||
wru.assert('first child is the expected one', div.removeChild(div.firstChild).nodeValue === 'I ');
|
wru.assert('first child is the expected one', div.removeChild(div.firstChild).nodeValue === 'I ');
|
||||||
img = div.removeChild(div.firstChild);
|
img = div.removeChild(div.firstChild);
|
||||||
@ -400,7 +400,7 @@ wru.test([{
|
|||||||
wru.assert('img on attributes are omitted',
|
wru.assert('img on attributes are omitted',
|
||||||
img.onclick === null &&
|
img.onclick === null &&
|
||||||
img.onmousedown === null
|
img.onmousedown === null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
name: 'folder option',
|
name: 'folder option',
|
||||||
@ -442,7 +442,7 @@ wru.test([{
|
|||||||
div.firstChild.className === 'emoji' &&
|
div.firstChild.className === 'emoji' &&
|
||||||
div.firstChild.getAttribute('draggable') === 'false' &&
|
div.firstChild.getAttribute('draggable') === 'false' &&
|
||||||
div.firstChild.getAttribute('alt') === "5️⃣" &&
|
div.firstChild.getAttribute('alt') === "5️⃣" &&
|
||||||
div.firstChild.src === 'http://twemoji.maxcdn.com/36x36/35-20e3.png'
|
div.firstChild.src === 'https://twemoji.maxcdn.com/36x36/35-20e3.png'
|
||||||
);
|
);
|
||||||
wru.assert('the length is preserved',
|
wru.assert('the length is preserved',
|
||||||
div.getElementsByTagName('img')[0].alt.length === 3);
|
div.getElementsByTagName('img')[0].alt.length === 3);
|
||||||
@ -457,7 +457,7 @@ wru.test([{
|
|||||||
div.firstChild.className === 'emoji' &&
|
div.firstChild.className === 'emoji' &&
|
||||||
div.firstChild.getAttribute('draggable') === 'false' &&
|
div.firstChild.getAttribute('draggable') === 'false' &&
|
||||||
div.firstChild.getAttribute('alt') === "5⃣" &&
|
div.firstChild.getAttribute('alt') === "5⃣" &&
|
||||||
div.firstChild.src === 'http://twemoji.maxcdn.com/36x36/35-20e3.png'
|
div.firstChild.src === 'https://twemoji.maxcdn.com/36x36/35-20e3.png'
|
||||||
);
|
);
|
||||||
wru.assert('the length is preserved',
|
wru.assert('the length is preserved',
|
||||||
div.getElementsByTagName('img')[0].alt.length === 2);
|
div.getElementsByTagName('img')[0].alt.length === 2);
|
||||||
@ -553,4 +553,4 @@ wru.test([{
|
|||||||
wru.assert('OK');
|
wru.assert('OK');
|
||||||
})});
|
})});
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
|
Loading…
Reference in New Issue
Block a user