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

Add error prefix to errored page titles #1219

Merged
merged 1 commit into from
Feb 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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