Skip to content

Commit

Permalink
Merge pull request #1219 from alphagov/add-error-to-titles-for-pages-…
Browse files Browse the repository at this point in the history
…that-error

Add error prefix to errored page titles
  • Loading branch information
NickColley authored Feb 25, 2019
2 parents 68bd09b + 10afa92 commit c9b330c
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 11 deletions.
32 changes: 31 additions & 1 deletion app/full-page-examples.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ describe(`http://localhost:${PORT}/full-page-examples/`, () => {
expect(res.statusCode).toBe(200)
expect($.html()).toContain('Send your feedback to GOV.UK Verify')

// Check the title has an error
expect($('title').text()).toContain('Error:')

// Check that the error summary is visible
let $errorSummary = $('[data-module="error-summary"]')
expect($errorSummary.length).toBeTruthy()
Expand Down Expand Up @@ -110,6 +113,9 @@ describe(`http://localhost:${PORT}/full-page-examples/`, () => {
expect(res.statusCode).toBe(200)
expect($.html()).toContain('Have you changed your name?')

// Check the title has an error
expect($('title').text()).toContain('Error:')

// Check that the error summary is visible
let $errorSummary = $('[data-module="error-summary"]')
expect($errorSummary.length).toBeTruthy()
Expand Down Expand Up @@ -141,6 +147,9 @@ describe(`http://localhost:${PORT}/full-page-examples/`, () => {
expect(res.statusCode).toBe(200)
expect($.html()).toContain('Passport details')

// Check the title has an error
expect($('title').text()).toContain('Error:')

// Check that the error summary is visible
let $errorSummary = $('[data-module="error-summary"]')
expect($errorSummary.length).toBeTruthy()
Expand Down Expand Up @@ -172,6 +181,9 @@ describe(`http://localhost:${PORT}/full-page-examples/`, () => {
expect(res.statusCode).toBe(200)
expect($.html()).toContain('Update your account details')

// Check the title has an error
expect($('title').text()).toContain('Error:')

// Check that the error summary is visible
let $errorSummary = $('[data-module="error-summary"]')
expect($errorSummary.length).toBeTruthy()
Expand Down Expand Up @@ -203,6 +215,9 @@ describe(`http://localhost:${PORT}/full-page-examples/`, () => {
expect(res.statusCode).toBe(200)
expect($.html()).toContain('Upload your photo')

// Check the title has an error
expect($('title').text()).toContain('Error:')

// Check that the error summary is visible
let $errorSummary = $('[data-module="error-summary"]')
expect($errorSummary.length).toBeTruthy()
Expand Down Expand Up @@ -234,6 +249,9 @@ describe(`http://localhost:${PORT}/full-page-examples/`, () => {
expect(res.statusCode).toBe(200)
expect($.html()).toContain('How do you want to sign in?')

// Check the title has an error
expect($('title').text()).toContain('Error:')

// Check that the error summary is visible
let $errorSummary = $('[data-module="error-summary"]')
expect($errorSummary.length).toBeTruthy()
Expand Down Expand Up @@ -265,6 +283,9 @@ describe(`http://localhost:${PORT}/full-page-examples/`, () => {
expect(res.statusCode).toBe(200)
expect($.html()).toContain('What is your nationality?')

// Check the title has an error
expect($('title').text()).toContain('Error:')

// Check that the error summary is visible
let $errorSummary = $('[data-module="error-summary"]')
expect($errorSummary.length).toBeTruthy()
Expand Down Expand Up @@ -296,6 +317,9 @@ describe(`http://localhost:${PORT}/full-page-examples/`, () => {
expect(res.statusCode).toBe(200)
expect($.html()).toContain('What is your address?')

// Check the title has an error
expect($('title').text()).toContain('Error:')

// Check that the error summary is visible
let $errorSummary = $('[data-module="error-summary"]')
expect($errorSummary.length).toBeTruthy()
Expand Down Expand Up @@ -327,6 +351,9 @@ describe(`http://localhost:${PORT}/full-page-examples/`, () => {
expect(res.statusCode).toBe(200)
expect($.html()).toContain('What is your home postcode?')

// Check the title has an error
expect($('title').text()).toContain('Error:')

// Check that the error summary is visible
let $errorSummary = $('[data-module="error-summary"]')
expect($errorSummary.length).toBeTruthy()
Expand All @@ -351,13 +378,16 @@ describe(`http://localhost:${PORT}/full-page-examples/`, () => {
})
})
it('should show errors if form is submitted with no input', (done) => {
requestPath.post(`what-was-the-last-country-you-visited`, (err, res) => {
requestPath.post('what-was-the-last-country-you-visited', (err, res) => {
let $ = cheerio.load(res.body)

// Check the page responded correctly
expect(res.statusCode).toBe(200)
expect($.html()).toContain('What was the last country you visited?')

// Check the title has an error
expect($('title').text()).toContain('Error:')

// Check that the error summary is visible
let $errorSummary = $('[data-module="error-summary"]')
expect($errorSummary.length).toBeTruthy()
Expand Down
2 changes: 1 addition & 1 deletion app/views/full-page-examples/feedback/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% from "error-summary/macro.njk" import govukErrorSummary %}

{% set pageTitle = "Send your feedback to GOV.UK Verify" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% from "button/macro.njk" import govukButton %}

{% set pageTitle = "Have you changed your name?" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% block beforeContent %}
{{ govukBackLink({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% from "error-summary/macro.njk" import govukErrorSummary %}

{% set pageTitle = "How do you want to sign in?" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% block beforeContent %}
{{ govukBackLink({
Expand Down
2 changes: 1 addition & 1 deletion app/views/full-page-examples/passport-details/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% from "button/macro.njk" import govukButton %}

{% set pageTitle = "Passport details" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% from "button/macro.njk" import govukButton %}

{% set pageTitle = "Update your account details" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

Expand Down
2 changes: 1 addition & 1 deletion app/views/full-page-examples/upload-your-photo/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{% from "file-upload/macro.njk" import govukFileUpload %}

{% set pageTitle = "Upload your photo" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% from "button/macro.njk" import govukButton %}

{% set pageTitle = "What is your home address?" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% block beforeContent %}
{{ govukBackLink({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{% from "error-summary/macro.njk" import govukErrorSummary %}

{% set pageTitle = "What is your nationality?" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% block beforeContent %}
{{ govukBackLink({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% from "input/macro.njk" import govukInput %}

{% set pageTitle = "What is your home postcode?" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% block beforeContent %}
{{ govukBackLink({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% from "input/macro.njk" import govukInput %}

{% set pageTitle = "What was the last country you visited?" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% block beforeContent %}
{{ govukBackLink({
Expand Down

0 comments on commit c9b330c

Please sign in to comment.