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

Make organisations field searchable #3172

Closed
wants to merge 3 commits into from

Conversation

yndajas
Copy link
Member

@yndajas yndajas commented Sep 17, 2024

This upgrades the organisations field in the page for inviting a new user to use the accessible autocomplete module (with progressive enhancement)

Screen recording

Before

Screen.Recording.2024-09-17.at.11.53.15.mov

After

Screen.Recording.2024-09-17.at.11.51.38.mov

This application is owned by the publishing platform team. Please let us know in #govuk-publishing-platform when you raise any PRs.

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.

This helper module adds a few assertion methods that can be used across
specs that test our custom autocomplete behaviours

They're used here in a few updating permissions tests, and will be used
in the next commit in new inviting users tests when adding autocomplete
to the organisation field
This upgrades the organisations field in the page for inviting a new
user to use the accessible autocomplete module (with progressive
enhancement)
@yndajas yndajas force-pushed the make-organisations-field-searchable branch from b0817b6 to 4cb1dae Compare September 17, 2024 10:59

should("not show an 'Add' button") { assert_no_selector "button", text: "Add" }

should "reset the value of the select element when it no longer matches what's shown in the autocomplete input" do
Copy link
Contributor

Choose a reason for hiding this comment

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

How would you feel about extracting these tests into more "component" style tests? That way we'd only need to test it once as we're reusing the component across multiple pages.

As it stands we're testing this behaviour twice across the two integration tests. We could then restrict the two test files modified in this PR to only test a user inputting some text into the autocomplete and inviting a user.

assert_equal "addin", @autocomplete_input.value
assert_equal @new_permission_to_grant.name, autocomplete_option.text
assert_equal "", @select_element.value
assert_resets_select_when_desynced_with_autocomplete(
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are going to go down a more abstracted approach with our tests, could we make method names for our helpers even more human readable? I know we're following the lead taken by Minitest here, but I'm not the biggest fan of the brevity of Minitest's DSL.

Also, forgive my ignorance but I'm not sure what desynced means!

@yndajas yndajas force-pushed the make-organisations-field-searchable branch 2 times, most recently from f022db3 to 125ae44 Compare September 18, 2024 16:34
This allows us to get away from testing this custom JavaScript behaviour
in multiple integration tests. We might want to test that everything
works without the add/add and finish buttons being present (it does)
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.

2 participants