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

Update Text.ts #9041

Closed

Conversation

VardaQuraishi
Copy link

This is a fix to Text style bug? #9010 issue.
I have tested the code and it is passing all checks.

Copy link
Contributor

@ShaMan123 ShaMan123 left a 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

Comment on lines +1650 to 1651
? this.fontFamily
: `"${style.fontFamily}"`;
Copy link
Contributor

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

Copy link
Author

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?

Could you help against this
image

Copy link
Author

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

@asturur
Copy link
Member

asturur commented Jul 1, 2023

Please check the request for the git blame verification in the original issue.

Copy link
Contributor

@ShaMan123 ShaMan123 left a 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
Copy link
Contributor

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 ||
Copy link
Contributor

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

ShaMan123 added a commit that referenced this pull request Jul 9, 2023
@asturur asturur closed this in #9082 Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants