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 the details component #480

Merged
merged 2 commits into from
Jan 30, 2018
Merged

Conversation

36degrees
Copy link
Contributor

@36degrees 36degrees commented Jan 29, 2018

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-480 January 29, 2018 16:51 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-480 January 29, 2018 16:52 Inactive
const { $ } = render('details', examples.default)

// Look for the summary element within the details element
const $summary = $('.govuk-c-details__summary', '.govuk-c-details')
Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't even know you could do this, I've been doing $('...').find('...') all this time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think it's called 'context' in jQuery-land. I've seen in the past people generally aren't that aware of it – hence the comment. Do you think it's clear enough what's it doing?

Copy link
Contributor

@NickColley NickColley Jan 29, 2018

Choose a reason for hiding this comment

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

In this specific case I'd just rely on good ol' CSS selectors $('.govuk-c-details .govuk-c-details__summary') which would hopefully be more widely understood.

Either way the comment is good, so not blocking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good call, though not sure we'd want to use > as that would be testing that the summary is a direct descendant - which I don't think we care about?

Copy link
Contributor

Choose a reason for hiding this comment

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

I stealth removed the direct descendant, but wasn't quick enough 😢

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😁

Copy link
Contributor

@NickColley NickColley left a comment

Choose a reason for hiding this comment

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

Nice, looks good to me. 👍

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-480 January 29, 2018 17:29 Inactive
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.

3 participants