-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Update Text.ts #9041
Update Text.ts #9041
Conversation
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.
Please run npm run prettier:write
and commit
After that the diff will be meaningful
The fact that tests pass is meaningless because they are passing without this PR, meaning this is not covered by a test so you should add a test that is failing on master and passing here
? this.fontFamily | ||
: `"${style.fontFamily}"`; |
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.
I thought the point was to use family
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.
Thank you @ShaMan123 for guiding me through.
The highlighted line (const family = style.fontFamily || this.fontFamily;) checks if the style object has a valid fontFamily property. If it does, family will be assigned the value of style.fontFamily. Otherwise, it will fall back to the this.fontFamily property.
I have run npm run prettier:write
. Are there any other commands or tests that needs to be run?
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.
I have also added a unit test in the text/unit file and all tests are passing
Please check the request for the git blame verification in the original issue. |
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.
You also need to refine this pr
family === undefined || | ||
family.indexOf("'") > -1 || | ||
family.indexOf(',') > -1 || | ||
family.indexOf('"') > -1 || | ||
fontIsGeneric | ||
? style.fontFamily | ||
? this.fontFamily |
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 makes no sense
const style = styleObject || this; | ||
const family = style.fontFamily || this.fontFamily; | ||
const fontIsGeneric = Text.genericFonts.indexOf(family.toLowerCase()) > -1; | ||
const formattedFontFamily = | ||
family === undefined || |
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 will never happen now
This is a fix to Text style bug? #9010 issue.
I have tested the code and it is passing all checks.