-
Notifications
You must be signed in to change notification settings - Fork 115
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(label): remove hardcoded strings for i18n #2274
Conversation
🦋 Changeset detectedLatest commit: 6cb19a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 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 |
✔️ Deploy Preview for paste-theme-designer ready! 🔨 Explore the source changes: 6cb19a1 🔍 Inspect the deploy log: https://app.netlify.com/sites/paste-theme-designer/deploys/6228d71fc160e10009ca32e2 😎 Browse the preview: https://deploy-preview-2274--paste-theme-designer.netlify.app |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 6cb19a1:
|
✔️ Deploy Preview for paste-docs ready! 🔨 Explore the source changes: 6cb19a1 🔍 Inspect the deploy log: https://app.netlify.com/sites/paste-docs/deploys/6228d71eea3a8f000ba236b4 😎 Browse the preview: https://deploy-preview-2274--paste-docs.netlify.app |
Size Change: +90 B (0%) Total Size: 508 kB
ℹ️ View Unchanged
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
@@ -75,12 +75,15 @@ describe('Checkbox', () => { | |||
}); | |||
|
|||
it('should render a required dot', () => { | |||
const {getByText} = render( | |||
render( |
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.
praise: nice little tidy up to best practices here
children, | ||
variant, | ||
element = 'LABEL', | ||
i18nRequiredLabel = '', |
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.
question: is it safe to say that if the label is rendered as a label i18nRequiredLabel
should be empty by default, but if it is rendered as legend i18nRequiredLabel
should be (required)
by default. Is that an over simplification?
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.
Oh! thats exactly correct.
I just had it default to nothing and then checkboxGroup and radioGroup set it to '(required)'.
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.
Looks good 👍🏼
Upon investigation, the original ticket didn't account for when there is a RequiredDot in a legend.
When the RequiredDot is in a label for an an input, it should not have text because the input has the required attribute (hence why the default value of i18nLabel prop on RequiredDot is ''.
When RequiredDot is in a legend for a fieldset, it should have the text 'required' because legends and fieldsets do not have the required attribute.
This PR includes:
Label
Checkbox
RadioGroup
InlineControlGroup
Contributing to Twilio