Skip to content

Commit

Permalink
Use an autocomplete for registrar selection
Browse files Browse the repository at this point in the history
  • Loading branch information
maxf committed Mar 13, 2024
1 parent 0cd0bbc commit eb33bcf
Show file tree
Hide file tree
Showing 24 changed files with 33 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/bad-email.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ describe('Email format verification', () => {
cy.visit('http://0.0.0.0:8000/')

cy.get('h1').should('include.text', 'Which .gov.uk Approved Registrar organisation are you from?')
cy.get('select.govuk-select').select('WeRegister')
cy.get('#id_organisations_choice').type('WeRegister')
cy.get('.govuk-button#id_submit').click()

cy.get('h1').should('include.text', 'What is your email address?')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/exemption-happy-path.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Happy passes', () => {

cy.get('h1').should('include.text', 'Which .gov.uk Approved Registrar organisation are you from?')
cy.get('select.govuk-select').should('exist')
cy.get('select.govuk-select').select('WeRegister')
cy.get('#id_organisations_choice').type('WeRegister')
cy.get('.govuk-button#id_submit').click()


Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/happy-path.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Happy passes', () => {
cy.get('h1').should('include.text', 'Which .gov.uk Approved Registrar organisation are you from?')
cy.get('select.govuk-select').should('exist')

cy.get('select.govuk-select').select('WeRegister')
cy.get('#id_organisations_choice').type('WeRegister')

cy.get('.govuk-button#id_submit').click()

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/no-email.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ describe('Check if user entered an email', () => {
cy.visit('http://0.0.0.0:8000/')

cy.get('h1').should('include.text', 'Which .gov.uk Approved Registrar organisation are you from?')
cy.get('select.govuk-select').select('WeRegister')
cy.get('#id_organisations_choice').type('WeRegister')
cy.get('.govuk-button#id_submit').click()

// Don't type anything, just click on the button
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/no-org-type-selected.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ describe('Email format verification', () => {
cy.visit('http://0.0.0.0:8000/')

cy.get('h1').should('include.text', 'Which .gov.uk Approved Registrar organisation are you from?')
cy.get('select.govuk-select').select('WeRegister')
cy.get('#id_organisations_choice').type('WeRegister')
cy.get('.govuk-button#id_submit').click()

cy.get('h1').should('include.text', 'What is your email address?')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/no-registrar-selected.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Registrar no-select error', () => {
cy.get('#error-summary-title').should('include.text', 'There is a problem')
cy.get('#id_organisations_choice_1_error').should('include.text', 'This field is required')

cy.get('select.govuk-select').select('WeRegister')
cy.get('#id_organisations_choice').type('WeRegister')
cy.get('.govuk-button#id_submit').click()

cy.get('h1').should('include.text', 'What is your email address?')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/not-eligible.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ describe('Registrant not eligible', () => {
cy.visit('http://0.0.0.0:8000/')

cy.get('h1').should('include.text', 'Which .gov.uk Approved Registrar organisation are you from?')
cy.get('select.govuk-select').select('WeRegister')
cy.get('#id_organisations_choice').type('WeRegister')
cy.get('.govuk-button#id_submit').click()


Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/written-permission-yes.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Traverses to Written Permission page and selects Yes', () => {
cy.get('h1').should('include.text', 'Which .gov.uk Approved Registrar organisation are you from?')
cy.get('select.govuk-select').should('exist')

cy.get('select.govuk-select').select('WeRegister')
cy.get('#id_organisations_choice').type('WeRegister')

cy.get('.govuk-button#id_submit').click()

Expand Down
2 changes: 1 addition & 1 deletion request_a_govuk_domain/request/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ class RegistrarForm(forms.Form):
Registrar Form with organisations choice fields
"""

registrars = [("", "Select an item from the list")] + list(
registrars = [("", "")] + list(
(f"registrar-{registrar.id}", registrar.name)
for registrar in Registrar.objects.all()
)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion request_a_govuk_domain/request/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<link rel="manifest" href="{% static 'manifest.json' %}">
<link rel="stylesheet" href="{% static 'govuk-frontend-5.0.0.min.css' %}">

{% block extra_stylesheets %}{% endblock %}
</head>
<body class="govuk-template__body">
<script>document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');</script>
Expand Down Expand Up @@ -92,5 +92,6 @@

initAll()
</script>
{% block bottomjs %}{% endblock %}
</body>
</html>
14 changes: 14 additions & 0 deletions request_a_govuk_domain/request/templates/registrar.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "base.html" %}
{% load static %}
{% load crispy_forms_tags crispy_forms_gds %}
{% load govuk_frontend_django %}

Expand All @@ -18,5 +19,18 @@ <h1 class="govuk-heading-l">
</div>
</div>
{% endblock %}
{% endblock %}

{% block bottomjs %}
<script type="text/javascript" src="{% static 'accessible-autocomplete.min.js' %}"></script>
<script>
accessibleAutocomplete.enhanceSelectElement({
selectElement: document.querySelector('#id_organisations_choice'),
menuClasses: "govuk-list"
})
</script>
{% endblock %}

{% block extra_stylesheets %}
<link rel="stylesheet" href="{% static 'accessible-autocomplete.min.css' %}">
{% endblock %}

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.
Loading

0 comments on commit eb33bcf

Please sign in to comment.