-
Notifications
You must be signed in to change notification settings - Fork 327
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
Include hidden status of the component examples in published fixtures #2031
Include hidden status of the component examples in published fixtures #2031
Conversation
It occurs to me that the hidden flag could be renamed in the fixtures, to make it clearer what it means? Or maybe just document it somewhere, wherever the fixtures are currently documented... |
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.
Thanks @andymantell. I've tested this locally by building the package and the hidden examples now correctly contain a hidden
field in the fixtures.
Just need a second approval from someone in our team and then we can merge this.
I think that's a good idea to think about whether the hidden attribute could be more clearly worded. I think we could generally do with learning a bit more about how the fixtures are being used and if there are any improvements we could make so we should definitely look at the naming of things as part of that 👍
Thanks @hannalaakso I guess once this is merged and released though it becomes harder to rename later. I understand the hidden flag because I've been loitering in this codebase for years, but to someone inspecting just the package that arrives in their node_modules folder I think that What about Alternatively - should the visible examples on the design system docs actually exhaustively demonstrate everything that the component is capable of? Perhaps there shouldn't be a concept of hidden examples? |
I wonder if
The component examples in the GOV.UK Frontend review app are useful to check against when we make changes that could cause a visual regression (ideally this type of testing would be handled by automated visual regression tests but for now we’re doing it manually). The examples that we’ve decided to hide typically cause no visual changes but might set a custom class etc. which is something we can run automated tests on. We therefore hide those examples to simplify our manual visual regression checks. |
@andymantell Would you be okay to add this PR in the Changelog under Fixes? |
Yup, on it now... |
3b9ce88
to
96c3c90
Compare
@hannalaakso Done |
I've pushed an extra commit to update the tests that we run on the built package to take the new hidden attribute into account. This flagged that the |
Thanks @36degrees |
alphagov/govuk-frontend#2031 adds a new `hidden` property to the objects in the fixtures list. Update the fixtures included in the example JSON to include the new `hidden` property, and document it in the list of properties.
In order for downstream projects to use the component examples for rendering as well as for tests, it is useful to know which examples should be hidden from display since they were designed for tests only.
Remove the outer `expect.objectContaining` so that any additional top level keys in the fixture object cause the tests to fail. Co-erce the hidden attribute to a boolean to ensure it’s always present, rather than only being present when it’s set in the YAML.
892f4d3
to
49ad231
Compare
I've rebased this so that the CHANGELOG entry is added in the right place – it was being appended to the list of fixes that went out in 3.10.1. |
alphagov/govuk-frontend#2031 adds a new `hidden` property to the objects in the fixtures list. Update the fixtures included in the example JSON to include the new `hidden` property, and document it in the list of properties.
Thanks 👍🏻 |
In order for downstream projects to use the component examples for rendering as well as for tests, it is useful to know which examples should be hidden from display since they were designed for tests only.
I have therefore modified the gulp script slightly to include that
hidden
field when packaging up the fixtures.To give some context - I used to use the example yaml files directly in govuk-react-jsx to render the demonstration app. I am working on the 3.9.0 update which added the fixtures.json files and so am switching across to those, but these now contain additional hidden examples which were not there before, and don't make a lot of sense when rendered on screen since they are often so minimal. I would therefore like to hide these from display.