-
Notifications
You must be signed in to change notification settings - Fork 29
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 Issue #80 inserting every fontUsage (including unused font) for multiple html target #81
Conversation
…ut subsetPerPage option
Pull Request Test Coverage Report for Build 290
💛 - Coveralls |
1 similar comment
Pull Request Test Coverage Report for Build 290
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution, and sorry for the lack of feedback until now.
It's a bit hard to tell if it's a legit issue -- could you provide a failing test for the current state?
// https://gitter.im/assetgraph/assetgraph?at=5dbb6438a3f0b17849c488cf | ||
it('should not short circuit because the first page does not need any subset fonts', async function() { | ||
it('should not short circuit with explicit subsetPerPage:true option because the first page does not need any subset fonts', async function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably deserves to be its own test case alongside the existing one.
However, if I copy your test over to master, it also passes? Can you come up with an actual regression test?
htmlAssetTextsWithProps, | ||
htmlAssetTextWithProps => htmlAssetTextWithProps.fontUsages | ||
); | ||
const globalFontUsageMap = fontUsagesConcat.reduce( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind turning this reduce
construct into a regular for
...of
loop? I find those much easier to reason about.
fontUsageMap[fontUsage.fontUrl].text + fontUsage.text | ||
) | ||
.sort() | ||
.join(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, mental note that we should find a better way achieve the "unique across pages" thing, sorting the output of _.uniq
breaks when there's multiple non-UTF-16 characters:
require('lodash').uniq('🤗').sort().join('')
'🤗'
require('lodash').uniq('🤗🤞').sort().join('')
'🤗�'
require('lodash').uniq('🤗🤞👊').sort().join('')
'���'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't have the same problem. Not very readable though:
[...new Set([...'🤗🤞👊'])].sort().join('')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I think we should go with that, then. Not readable is better than broken :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented your fix here: #87
Replaced by #111 |
No description provided.