Skip to content

Commit

Permalink
fix(is-icon-ligature): ignore whitespace characters (#1908)
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Nov 18, 2019
1 parent 9ae07fb commit 7d2b2a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/commons/text/is-icon-ligature.js
Expand Up @@ -72,7 +72,7 @@ text.isIconLigature = function(
* │ │█│█│█│█│█│█│█│█│█│█│█│█│█│ │
* └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
*/
const nodeValue = textVNode.actualNode.nodeValue;
const nodeValue = textVNode.actualNode.nodeValue.trim();

// text with unicode or non-bmp letters cannot be ligature icons
if (
Expand Down
7 changes: 7 additions & 0 deletions test/commons/text/is-icon-ligature.js
Expand Up @@ -121,6 +121,13 @@ describe('text.isIconLigature', function() {
}
);

(fontApiSupport ? it : it.skip)('should trim the string', function() {
var target = queryFixture(
'<div id="target" style="font-family: Roboto"> fflu shot </div>'
);
assert.isFalse(isIconLigature(target.children[0]));
});

(fontApiSupport ? it : it.skip)(
'should return true for a font that has no character data',
function() {
Expand Down

0 comments on commit 7d2b2a6

Please sign in to comment.