-
Notifications
You must be signed in to change notification settings - Fork 267
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
feat(clerk-js,types): Add navbar button text descriptor and localization key #4635
base: main
Are you sure you want to change the base?
feat(clerk-js,types): Add navbar button text descriptor and localization key #4635
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 7fa0dab The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
const customElements = screen.getAllByText(/Custom1/i); | ||
expect(customElements.some(el => el.tagName.toUpperCase() === 'BUTTON')).toBe(true); | ||
const externalElements = screen.getAllByText(/ExternalLink/i); | ||
expect(externalElements.some(el => el.tagName.toUpperCase() === 'BUTTON')).toBe(true); |
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.
Update selectors using best practices https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#not-using-byrole-most-of-the-time
<Span | ||
elementDescriptor={descriptors.navbarButtonText} | ||
elementId={descriptors.navbarButtonText.setId(r.id as any)} | ||
localizationKey={r.name} | ||
/> |
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.
❓ Could this be replaced with <Text as="span"/>
?
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.
No because of the default styles the <Text />
component applies.
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.
got it
Description
Currently userprofile navbar buttons don't have visible localization keys since the have a icon within the button, since when a localizationKey is provided, the icon gets removed due to makeLocalizeable converting the children to a string. I had trouble tracking down the localization key for the navbar buttons since it was not visible in the dom as expected.
I am proposing introducing a generic that can be used to hold the localization key. Text as span currently carries styles that may not be intended in use.
Example:
Resolves SDKI-769
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change