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 (take two) #3177

Merged
merged 3 commits into from
Sep 26, 2024

Conversation

yndajas
Copy link
Member

@yndajas yndajas commented Sep 19, 2024

Trello

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

This is reworked from and closes #3172

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.

@yndajas yndajas force-pushed the make-organisations-field-searchable-v2 branch from 7d6a10f to 067f91c Compare September 19, 2024 14:12
@yndajas yndajas changed the title Make organisations field searchable v2 Make organisations field searchable (take two) Sep 19, 2024
@yndajas yndajas marked this pull request as ready for review September 19, 2024 14:31
Copy link
Contributor

@callumknights callumknights left a comment

Choose a reason for hiding this comment

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

This looks good to me. With the distinct caveat that I am not a great Javascript dev, so it still might be worth a 3rd pair of eyes, maybe @Gweaton?

When improving the clear button for the accessible autocomplete
component (0c5d5a1), we moved to integration tests using Capybara with
Selenium, instead of unit tests with Jasmine. This was because the
button was moved outside of the autocomplete module, which caused issues
with Jasmine-based testing

This slightly restructures the template where we use accessible
autocomplete to wrap all the elements the JavaScript needs to access in
the `div[data-module=accessible-autocomplete]` element. We then use
dependency injection to pass the module to custom functions that enhance
the form. These changes allow us to revert to the unit test approach,
which in turn means we can introduce the autocomplete component into
other templates without needing to test context-independent
functionality in multiple integration test specs

I've retained a couple of the JavaScript-enabled integration tests where
they're more about checking everything works in a specific context
@Gweaton Gweaton force-pushed the make-organisations-field-searchable-v2 branch from 067f91c to 170fc4f Compare September 26, 2024 10:25
Copy link
Contributor

@Gweaton Gweaton left a comment

Choose a reason for hiding this comment

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

Looks good (if I say so myself), thanks for putting up with my arguable scope creep...

@yndajas yndajas force-pushed the make-organisations-field-searchable-v2 branch from 170fc4f to 3ffc0cb Compare September 26, 2024 10:32
yndajas and others added 2 commits September 26, 2024 11:34
The tests in this file kept this DRY but were a little tricky to figure
out at a glance what each test was doing. We've refactored them a fair
bit to remove some of the abstractions and make them easier to read,
while still looping over the two use cases of updating one's own
permissions and updating those of another user.

This refactor was prompted by the addition of a new Accessible
Autocomplete component to the Organisations page. We've added a new
AutocompleteHelper in this commit to perform some simple Autocomplete
actions and prevent us needing to re-write a few lines of code to find
and select an option.

It's used here for updating permissions tests, and will be used in the
next commit in inviting users tests when adding autocomplete to the
organisation field.

Apologies for multiple changes going on in this commit, it's
essentially:
- Adding a new Autocomplete Helper for reuse in other areas of the
  service that use the Accessible Autocomplete.
- Refactoring the tests to use this new helper and to improve
  readability.

Co-authored-by: George Eaton <george@dxw.com>
This upgrades the organisations field in the page for inviting a new
user to use the accessible autocomplete module (with progressive
enhancement)

Co-authored-by: George Eaton <george@dxw.com>
@yndajas yndajas force-pushed the make-organisations-field-searchable-v2 branch from 3ffc0cb to 0647a29 Compare September 26, 2024 10:35
@yndajas yndajas merged commit ee47b83 into main Sep 26, 2024
15 checks passed
@yndajas yndajas deleted the make-organisations-field-searchable-v2 branch September 26, 2024 10:40
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