-
Notifications
You must be signed in to change notification settings - Fork 0
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 helper: click_govuk_link #6
Conversation
This is a drop-in replacement for the capybara `click_link` helper, but adds some additional checks.
@paulrobertlloyd @peteryates @joelanman can you think of any other link-related accessibility or usability checks that could be included? |
|
Building on @joelanman’s suggestion, how about a warning if the |
Oh, I wasn’t sure that was allowed. Will check.
I was planning on adding a separate
👍
@joelanman could you explain this one? I’ve never seen a button within a link… 🤔 |
ha there's no explanation - some people do it! |
@joelanman @paulrobertlloyd thanks! I've incorporated all your suggestions. You can see the documentation page for this helper here: https://x-govuk.github.io/govuk-rspec-helpers/click-govuk-link/ We can continue to add checks in future if needed! |
Ooh, documentation. Sounds like somebody wants a homepage illustration, right? Right!? |
I like this ❤️ One thing that is probably worth checking for is when Many of these will be solved by the new link helpers coming in GOV.UK Components v5. |
@peteryates good shout! I've added that as an issue here: #14 - will open a PR shortly. |
Following the `click_govuk_link` helper added in #6, this does the same but for buttons. It will work with both actual `<button>`s, and with links styled as buttons – on the basis that the tests should reflect how the interfaces appears to users, rather than the underlying implementation. The helper currently does these checks: * full text of the button is specified, including any visually-hidden text * the button text is unique within the page * the `gov-button` class is added * `data-module="govuk-button"` is added (this is used by javascript which adds some accessibility enhancements) * if it’s a link styled as a button, then `role="button"` is present
This is a drop-in replacement for the capybara
click_link
helper, but also checks that:govuk-link
class (or another link class from the GOV.UK Design System)