Skip to content

Conversation

joybh98
Copy link
Contributor

@joybh98 joybh98 commented Sep 14, 2022

What does this PR do?

Adds the font-variant option to the global font type

Where should the reviewer start?

src/js/themes/base.d.ts

What testing has been done on this PR?

yarn test, tests failing

How should this be manually tested?

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • userEvent is used in place of fireEvent.
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

NA

What are the relevant issues?

#6289

Screenshots (if appropriate)

Do the grommet docs need to be updated?

Should this PR be mentioned in the release notes?

Is this change backwards compatible or is it a breaking change?

Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!
I think the following needs added to the src/js/utils/styles.js file in baseStyle so that we make sure the font variant we are passing through the theme actually gets applied:
font-variant: ${(props) => props.theme.global.font.variant};

After that try running yarn test-update to update the testing snapshots

@joybh98
Copy link
Contributor Author

joybh98 commented Sep 16, 2022

hi @jcfilben added font-variant,updated the tests, but still tests for some components are failing, do let me know what can be done.

And thanks for being patient and taking out the time to look at this PR! Appreciate it

@jcfilben
Copy link
Collaborator

hi @jcfilben added font-variant,updated the tests, but still tests for some components are failing, do let me know what can be done.

Hmm I'm not sure why the tests are acting strange. I'm going to try and just update the branch on my end and then push that up to this branch and see if that gets the tests to re-run

@joybh98
Copy link
Contributor Author

joybh98 commented Sep 18, 2022

@jcfilben checks are passing now ! Thank you ! Do let me know if any other changes and/or tests needs to be updated before merging.

Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@@ -9,6 +9,7 @@ export const baseStyle = css`
font-size: ${(props) => props.theme.global.font.size};
line-height: ${(props) => props.theme.global.font.height};
font-weight: ${(props) => props.theme.global.font.weight};
font-variant: ${(props) => props.theme.global.font.variant};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if there is no props.theme.global.font.variant, do we still include this in the CSS? If so, I'm wondering if we should make these more conditional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcfilben could you give some inputs?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could change these to be mode conditional by doing something like this, where we first check if the prop is defined in the theme before adding the css.

${(props) => props.theme.global.font.variant && `
    font-variant: ${props.theme.global.font.variant};
`}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcfilben done, fair warning tests are not passing, updated them using yarn test -u, still failing, do let me know what I have to correct and I'll correct it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange I'm not sure what is going on in your local environment that is causing the tests to behave oddly. I will go ahead and do the same thing we did last time and update the branch from my end to get the tests to re-run.

If you create any future pull requests it might be worth starting with a fresh fork of grommet to see if that resolves any issues with the tests, but no need to do that for this pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcfilben noted ! any future PRs will be with a fresh fork! Thanks for taking out the time to update the branch. Let me know if anything else needs to be done for this PR

@ericsoderberghp ericsoderberghp merged commit 36d626b into grommet:master Sep 27, 2022
@jcfilben
Copy link
Collaborator

@joybh98 thanks for contributing to Grommet!

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