Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(is-icon-ligature): ignore whitespace characters #1908

Merged
merged 1 commit into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/commons/text/is-icon-ligature.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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