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

Add tests for govuk-c-tag component #457

Merged
merged 3 commits into from
Jan 29, 2018
Merged

Add tests for govuk-c-tag component #457

merged 3 commits into from
Jan 29, 2018

Conversation

hannalaakso
Copy link
Member

@hannalaakso hannalaakso commented Jan 24, 2018

Add Jest tests for govuk-c-tag component.

These test if the component:

  • renders the default example with strong tag and text correctly
  • renders classes correctly
  • renders custom text correctly
  • renders escaped html when passed to text
  • renders html correctly
  • renders attributes correctly

Remove tag --with-html example from FE review app. This follows our decision that examples from the component definition that are now redundant and no longer useful in the review app are removed.

Trello card: https://trello.com/c/2Mv7onR8/637-automated-tests-for-tag-component

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-457 January 24, 2018 15:15 Inactive
@kr8n3r
Copy link

kr8n3r commented Jan 24, 2018

this looks good from my POV

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.

Looking good, bar one test that I don't think is doing what we need it to.


it('renders custom text correctly', () => {
const { $ } = render('tag', {
text: 'alpha'
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the same text as in the default example, so we could change the logic to hard code alpha and I think all of these tests would still pass? Suggest specifying some text that would not normally appear in any of our examples.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-457 January 25, 2018 16:54 Inactive
These test if the component:

- renders the default example with strong tag and text correctly
- renders classes correctly
- renders custom text correctly
- renders escaped html when passed to text
- renders html correctly
- renders attributes correctly
This follows our decision that examples from the component definition that are
now redundant and no longer useful in the review app are removed
@hannalaakso
Copy link
Member Author

This is ready to review.

I made the description of the tests resemble more closely the sort of natural language that we agreed on with the team.

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.

LGTM!

@hannalaakso hannalaakso merged commit 84d06e8 into master Jan 29, 2018
@hannalaakso hannalaakso deleted the component-tests branch January 29, 2018 09:58
@alex-ju alex-ju mentioned this pull request Feb 20, 2018
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.

4 participants