Skip to content
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

Component test files use examples #1924

Merged
merged 34 commits into from
Sep 2, 2020

Conversation

vanitabarrett
Copy link
Contributor

Resolves #1894

What

  • Updates component tests to consistently use the examples in the YAML files, and adds any tests for untested params
  • Adds a flag to hide examples that we don't want shown in the GOVUK Frontend review app
  • Adds a html param and example to the fieldset component as an alternative to caller

Why

Prep work for #1895

Note: I've left any examples that were previously visible in the review app as-is for now as I'm not sure what the reasoning was behind adding those particular examples as something to check. It's possible some of those examples could also be hidden with the new flag.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1924 August 21, 2020 10:10 Inactive
Copy link
Member

@hannalaakso hannalaakso left a comment

Choose a reason for hiding this comment

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

Looking really great so far, I've now reviewed the following:

  • warning text
  • textarea
  • tag
  • tabs
  • table
  • summary list
  • skip link
  • select
  • radios

src/govuk/components/tabs/template.test.js Show resolved Hide resolved
src/govuk/components/summary-list/template.test.js Outdated Show resolved Hide resolved
src/govuk/components/summary-list/template.test.js Outdated Show resolved Hide resolved
src/govuk/components/radios/radios.yaml Show resolved Hide resolved
Copy link
Member

@hannalaakso hannalaakso 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 👍 Reviewed

  • phase banner
  • panel
  • label
  • inset text
  • input

src/govuk/components/label/label.yaml Outdated Show resolved Hide resolved
36degrees
36degrees previously approved these changes Aug 26, 2020
src/govuk/components/accordion/template.test.js Outdated Show resolved Hide resolved
src/govuk/components/accordion/template.test.js Outdated Show resolved Hide resolved
src/govuk/components/button/template.test.js Outdated Show resolved Hide resolved
src/govuk/components/button/template.test.js Show resolved Hide resolved
src/govuk/components/button/template.test.js Outdated Show resolved Hide resolved
src/govuk/components/fieldset/template.njk Outdated Show resolved Hide resolved
src/govuk/components/file-upload/template.test.js Outdated Show resolved Hide resolved
@36degrees 36degrees dismissed their stale review August 26, 2020 10:56

Meant to just comment for now!

@vanitabarrett vanitabarrett force-pushed the component-test-files-use-examples branch from 916e650 to 4614684 Compare August 26, 2020 13:54
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1924 August 26, 2020 13:55 Inactive
@@ -147,3 +147,37 @@ examples:
text: Section B
content:
html: <a class="govuk-link" href="#">Link B</a>

# Hidden examples are not shown in the review app, but are used for tests and HTML fixtures
Copy link
Member

@hannalaakso hannalaakso Aug 26, 2020

Choose a reason for hiding this comment

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

Now that I've been working on adding the new prefix/suffix examples it strikes me that having the hidden examples at the end of the file makes it harder to scan the file to understand what examples already exist and having to move between the "visible" and "hidden" examples for the same thing which is kind of annoying.

This might just be me - but would be interesting to hear if either of you have any thoughts on how we organise the new examples in the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I chose to separate them out as when they were all together I found it difficult to quickly see which examples were shown in the review app and which weren't. But perhaps you'd only really need to do that when working on the fixtures, and most people would benefit from having all examples together?

Copy link
Member

Choose a reason for hiding this comment

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

It would make sense to me to group the examples for the same thing together 👍 If they're being added to the end of the file with no groupings it might become difficult to find anything there and if you're a contributor who's looking to potentially add a new example it would be helpful to see what already exists for that variant.

Copy link
Member

Choose a reason for hiding this comment

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

I do get that you'd need to move things in several files to do that @vanitabarrett. I don't know if @36degrees has any thoughts before you do that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect no matter our intentions they're going to get muddled up over time anyway 😬 Which might be an argument for not keeping them together, unless we think we can enforce that separation going forward? Do you think there's a logical way to order / group the examples?

Copy link
Member

Choose a reason for hiding this comment

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

I would have said the order in which they first appear in the test file, this seems to roughly follow the order of

default
with text
with html
with classes
with attributes

which would hopefully make the yaml easier to follow.

But I get your point that since we won't be programmatically enforcing it why even try to stick to a particular order.

@vanitabarrett vanitabarrett force-pushed the component-test-files-use-examples branch from 4614684 to c7336c2 Compare August 27, 2020 09:44
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1924 August 27, 2020 09:45 Inactive
@vanitabarrett vanitabarrett force-pushed the component-test-files-use-examples branch from c7336c2 to 410b844 Compare August 27, 2020 12:10
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1924 August 27, 2020 12:10 Inactive
@vanitabarrett vanitabarrett force-pushed the component-test-files-use-examples branch from 410b844 to 1e657a5 Compare August 27, 2020 13:21
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1924 August 27, 2020 13:22 Inactive
@vanitabarrett vanitabarrett force-pushed the component-test-files-use-examples branch from 1e657a5 to d2234cd Compare August 27, 2020 13:27
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1924 August 27, 2020 13:28 Inactive
@vanitabarrett vanitabarrett force-pushed the component-test-files-use-examples branch from d2234cd to 0bd7652 Compare August 27, 2020 14:32
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1924 August 27, 2020 14:33 Inactive
Copy link
Contributor

@36degrees 36degrees left a comment

Choose a reason for hiding this comment

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

Happy that any issues I flagged previously on the components that I reviewed have been addressed – and that this can be merged once @hannalaakso has approved.

Copy link
Member

@hannalaakso hannalaakso left a comment

Choose a reason for hiding this comment

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

Looks great to me too 👍

@vanitabarrett vanitabarrett modified the milestone: v3.9.0 Sep 2, 2020
@vanitabarrett vanitabarrett merged commit b87c026 into master Sep 2, 2020
@vanitabarrett vanitabarrett deleted the component-test-files-use-examples branch September 2, 2020 13:35
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.

Update component tests to always use the YAML examples
4 participants