GithubHelp home page GithubHelp logo

x-govuk / govuk-rspec-helpers Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 156 KB

RSpec test helpers for GOV.UK services

Home Page: https://x-govuk.github.io/govuk-rspec-helpers/

License: MIT License

Ruby 99.87% Shell 0.13%
rspec ruby

govuk-rspec-helpers's People

Contributors

frankieroberto avatar paulrobertlloyd avatar peteryates avatar

Watchers

 avatar

govuk-rspec-helpers's Issues

Consider adding support for data-prevent-double-click="true"

The Design System guidance for buttons says:

If you are working in production and research shows that users are frequently sending information twice, you can configure the button to ignore the second click.

To do this, set the data-prevent-double-click attribute to true.

However it also says:

In the case of slow connections, aim to give the user information about what’s happening, for example, by showing a loading spinner or a modal, before using data-prevent-double-click.

So we shouldn't expect it to be set on every button. Instead, it could be opt-in?

  click_govuk_button("Send", prevent_double_click: true)

cc @peteryates @paulrobertlloyd

Consider checking that there is only 1 primary (green) button

The Design System guidance for Buttons says:

Use a default button for the main call to action on a page.

Avoid using multiple default buttons on a single page. Having more than one main call to action reduces their impact, and makes it harder for users to know what to do next.

We could consider checking for this. However the guidance is only "avoid" rather than a hard rule, so it might need to be overridden.

Add a helper for filling in password fields

Following the addition of fill_in_govuk_text_field in #12 we should add a similar fill_in_govuk_password_field helper.

As well as checking that type=password, this could additionally check that:

  • autocomplete="new-password" or autocomplete="current-password"
  • spellcheck="false"

Error summary links might be to non-input elements

       Error message ‘Personal details not marked as complete’ links to #personal_details but no input field has this ID or name

The thing is that, in this instance, #personal_details is a link to another page where the error can be fixed:

<a name="personal_details" class="govuk-link" href="/trainees/ZWV3EDmJtXJqYSfkFv1GY8bi/personal-details/edit">Continue section<span class="govuk-visually-hidden"> personal details</span></a>

Add a helper for filling in email fields

Following the addition of fill_in_govuk_text_field in #12 we should add a similar fill_in_govuk_email_field helper.

As well as checking that type="email", this could additionally check that:

  • autocomplete="email" (could be opt-in or opt-out as you wouldn't want this if asking for someone else’s email)
  • spellcheck="false"

Add helper for filling in telephone fields

Following the addition of fill_in_govuk_text_field in #12 we should add a similar fill_in_govuk_telephone_number_field helper (or maybe fill_in_govuk_tel_field?).

As well as checking that type="tel", this could additionally check that:

  • autocomplete="tel" (could be opt-in or opt-out as you wouldn't want this if asking for someone else’s phone number)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.