-
Notifications
You must be signed in to change notification settings - Fork 334
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 required options for components #1979
Conversation
The back-link text defaults to "Back". You can provide just a `href` to the component and it will render correctly. Therefore, mark `text` and `html` as not required.
The character count threshold triggers the count message to be hidden by default. If not set, the count message is visible all the time. Therefore, mark the count threshold as not required.
If checkbox item.name is not set, then the component global nameis used instead. Therefore, mark the checkbox item.name as not required.
Match the description for the `item.name` option - when ommitted, the global option is applied instead
If the date input label is not provided, the name is used instead. Therefore, mark the label as not required.
The visuallyHiddenText option was missing the required option. It has a default value of "Error" so is not required, but let's make that clear and keep things consistent.
5254cce
to
bc91cc5
Compare
The footer navigation title does not have a default. If navigation is provided, but the title attribute is missed, you end up with an empty heading tag. Therefore, mark the title as required.
Make it clearer that if items.id is not set, then `idPrefix` is required instead.
It is possible to pass navigation items without a `href` - you might want to do this if you're showing the current page. However, passing a navigation item without one of `text` or `html` results in no text or link rendering at all. Following the pattern we use for other components, we should mark `navigation.text` and `navigation.html` as required and use the description to explain that one overrides the other. The description already explains the relationship between the two. Therefore, we should mark the navigation.text and navigation.html as required.
Both `text` and `href` attributes need to be present to create a link. A navigation item with no href or text does not render - you end up with an empty <ul> element. We also instruct users that a navigation.title is required, so you also end up with a heading with an empty list underneath. Therefore, mark navigation.items.text and navigation.items.href as required
Passing a href by itsef results in an invisible link (no visible text). Passing text by itself results in a link with no href. Therefore, mark the footer meta.items.text and meta.items.href as required.
bc91cc5
to
bb983b7
Compare
@@ -13,7 +13,7 @@ params: | |||
description: Type of input control to render. Defaults to "text". | |||
- name: inputmode | |||
type: string | |||
require: false | |||
required: false |
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 love it when you improve your test coverage and it catches stuff like this! 👏🏻
Great job.
The way the previous tests were structured seemed to test for the presence of at least one single object within the component options with the required attributes, instead of all options having the correct attributes. The same was happening for the fixtures file. This meant that one missing `required` attribute in a component yaml file would not cause the test to fail. This commit tests for the presence of the required attributes by looping through each option/fixture. It also fixes one typo picked up by these new tests.
bb983b7
to
d52f62f
Compare
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 is great. Thanks for putting the rationale in the commit messages – it made it really easy to review.
Part of #1965
What
required: false
required
attributes to optionsNot included:
required: false
but failing to pass a tag means that a blank tag (with background colour) is rendered. See issue here.