Skip to content

Commit

Permalink
Merge pull request #56 from LandRegistry/govuk-frontend-401
Browse files Browse the repository at this point in the history
GOV.UK Frontend 4.2.0
  • Loading branch information
matthew-shaw authored Jul 22, 2022
2 parents 6da3c20 + 711a9a2 commit de2042f
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 50 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/LandRegistry/govuk-frontend-wtf/compare/2.0.0..main)
## [Unreleased](https://github.com/LandRegistry/govuk-frontend-wtf/compare/2.1.0..main)

## [2.1.0](https://github.com/LandRegistry/govuk-frontend-wtf/releases/tag/2.1.0) - 22/07/2022

### Added

- [GOV.UK Frontend v4.2.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.2.0) support

## [2.0.0](https://github.com/LandRegistry/govuk-frontend-wtf/releases/tag/2.0.0) - 13/01/2022

Expand Down
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ members of the project's leadership.
## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
<https://www.contributor-covenant.org/faq>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# GOV.UK Frontend WTForms Widgets

[![PyPI version](https://badge.fury.io/py/govuk-frontend-wtf.svg)](https://pypi.org/project/govuk-frontend-wtf/)
![govuk-frontend 4.0.0](https://img.shields.io/badge/govuk--frontend%20version-4.0.0-005EA5?logo=gov.uk&style=flat)
![govuk-frontend 4.2.0](https://img.shields.io/badge/govuk--frontend%20version-4.2.0-005EA5?logo=gov.uk&style=flat)
[![Python package](https://github.com/LandRegistry/govuk-frontend-wtf/actions/workflows/python-package.yml/badge.svg)](https://github.com/LandRegistry/govuk-frontend-wtf/actions/workflows/python-package.yml)

**GOV.UK Frontend WTForms is a [community tool](https://design-system.service.gov.uk/community/resources-and-tools/) of the [GOV.UK Design System](https://design-system.service.gov.uk/). The Design System team is not responsible for it and cannot support you with using it. Contact the [maintainers](#contributors) directly if you need [help](#support) or you want to request a feature.**
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setuptools.setup(
name="govuk-frontend-wtf",
version="2.0.0",
version="2.1.0",
author="Matt Shaw",
author_email="[email protected]",
description="GOV.UK Frontend WTForms Widgets",
Expand Down
2 changes: 1 addition & 1 deletion tests/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from govuk_frontend_wtf.main import WTFormsHelpers

app = Flask(__name__)
app.config["SECRET_KEY"] = "M15zC@#&nMMj@J91IONM3CVubJDVIh$H" # nosec
app.config["SECRET_KEY"] = "405eb39c8ab0d1ab4a4ff56657a0d7aebf8ed079d4c5466a4933c72703a135f6" # nosec

app.jinja_loader = ChoiceLoader(
[
Expand Down
40 changes: 20 additions & 20 deletions tests/fixtures/wtf_widgets_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ TestDateField:
test_empty_get:
expected_output:
- <label class="govuk-label govuk-date-input__label" for="date_field-day">\s*Day\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field-day" name="date_field" type="text" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field-day" name="date_field" type="text" inputmode="numeric">
- <label class="govuk-label govuk-date-input__label" for="date_field-month">\s*Month\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field-month" name="date_field" type="text" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field-month" name="date_field" type="text" inputmode="numeric">
- <label class="govuk-label govuk-date-input__label" for="date_field-year">\s*Year\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-4" id="date_field-year" name="date_field" type="text" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-4" id="date_field-year" name="date_field" type="text" inputmode="numeric">
- <div id="date_field-hint" class="govuk-hint">\s*DateFieldHint\s*</div>
test_valid_post:
request:
Expand All @@ -59,11 +59,11 @@ TestDateField:
- 2020
expected_output:
- <label class="govuk-label govuk-date-input__label" for="date_field-day">\s*Day\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field-day" name="date_field" type="text" value="1" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field-day" name="date_field" type="text" value="1" inputmode="numeric">
- <label class="govuk-label govuk-date-input__label" for="date_field-month">\s*Month\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field-month" name="date_field" type="text" value="1" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field-month" name="date_field" type="text" value="1" inputmode="numeric">
- <label class="govuk-label govuk-date-input__label" for="date_field-year">\s*Year\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-4" id="date_field-year" name="date_field" type="text" value="2020" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-4" id="date_field-year" name="date_field" type="text" value="2020" inputmode="numeric">
- <div id="date_field-hint" class="govuk-hint">\s*DateFieldHint\s*</div>
test_invalid_post:
request:
Expand All @@ -76,11 +76,11 @@ TestDateField:
expected_output:
- <div class="govuk-form-group govuk-form-group--error">
- <label class="govuk-label govuk-date-input__label" for="date_field-day">\s*Day\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="date_field-day" name="date_field" type="text" value="A" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="date_field-day" name="date_field" type="text" value="A" inputmode="numeric">
- <label class="govuk-label govuk-date-input__label" for="date_field-month">\s*Month\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="date_field-month" name="date_field" type="text" value="B" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="date_field-month" name="date_field" type="text" value="B" inputmode="numeric">
- <label class="govuk-label govuk-date-input__label" for="date_field-year">\s*Year\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-4 govuk-input--error" id="date_field-year" name="date_field" type="text" value="C" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-4 govuk-input--error" id="date_field-year" name="date_field" type="text" value="C" inputmode="numeric">
- <div id="date_field-hint" class="govuk-hint">\s*DateFieldHint\s*</div>
request:
method: post
Expand All @@ -92,11 +92,11 @@ TestDateField:
expected_output:
- <div class="govuk-form-group govuk-form-group--error">
- <label class="govuk-label govuk-date-input__label" for="date_field-day">\s*Day\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="date_field-day" name="date_field" type="text" value="1" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="date_field-day" name="date_field" type="text" value="1" inputmode="numeric">
- <label class="govuk-label govuk-date-input__label" for="date_field-month">\s*Month\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="date_field-month" name="date_field" type="text" value=" " pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="date_field-month" name="date_field" type="text" value=" " inputmode="numeric">
- <label class="govuk-label govuk-date-input__label" for="date_field-year">\s*Year\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-4 govuk-input--error" id="date_field-year" name="date_field" type="text" value="2020" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-4 govuk-input--error" id="date_field-year" name="date_field" type="text" value="2020" inputmode="numeric">
- <div id="date_field-hint" class="govuk-hint">\s*DateFieldHint\s*</div>

TestDateFieldDefault:
Expand All @@ -105,11 +105,11 @@ TestDateFieldDefault:
test_empty_get:
expected_output:
- <label class="govuk-label govuk-date-input__label" for="date_field_default-day">\s*Day\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field_default-day" name="date_field_default" type="text" value="23" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field_default-day" name="date_field_default" type="text" value="23" inputmode="numeric">
- <label class="govuk-label govuk-date-input__label" for="date_field_default-month">\s*Month\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field_default-month" name="date_field_default" type="text" value="11" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="date_field_default-month" name="date_field_default" type="text" value="11" inputmode="numeric">
- <label class="govuk-label govuk-date-input__label" for="date_field_default-year">\s*Year\s*</label>
- <input class="govuk-input govuk-date-input__input govuk-input--width-4" id="date_field_default-year" name="date_field_default" type="text" value="2020" pattern="\[0-9\]\*" inputmode="numeric">
- <input class="govuk-input govuk-date-input__input govuk-input--width-4" id="date_field_default-year" name="date_field_default" type="text" value="2020" inputmode="numeric">
- <div id="date_field_default-hint" class="govuk-hint">\s*DateFieldHint\s*</div>

TestEmailField:
Expand Down Expand Up @@ -312,7 +312,7 @@ TestCharacterCountField:
- <textarea class="govuk-textarea govuk-js-character-count" id="charactercount_field" name="charactercount_field" rows="5" aria-describedby="charactercount_field-info charactercount_field-hint" required="required"></textarea>
- <label class="govuk-label" for="charactercount_field">\s*CharacterCountField\s*</label>
- <div id="charactercount_field-hint" class="govuk-hint">\s*CharacterCountFieldHint\s*</div>
- <div id="charactercount_field-info" class="govuk-hint govuk-character-count__message" aria-live="polite">\s*You can enter up to 200 characters\s*</div>
- <div id="charactercount_field-info" class="govuk-hint govuk-character-count__message">\s*You can enter up to 200 characters\s*</div>
test_output_sanitized:
request:
method: post
Expand All @@ -333,7 +333,7 @@ TestCharacterCountField:
- <textarea class="govuk-textarea govuk-js-character-count" id="charactercount_field" name="charactercount_field" rows="5" aria-describedby="charactercount_field-info charactercount_field-hint" required="required">Foo\n&lt;p&gt;Bar&lt;/p&gt;\s*</textarea>
- <label class="govuk-label" for="charactercount_field">\s*CharacterCountField\s*</label>
- <div id="charactercount_field-hint" class="govuk-hint">\s*CharacterCountFieldHint\s*</div>
- <div id="charactercount_field-info" class="govuk-hint govuk-character-count__message" aria-live="polite">\s*You can enter up to 200 characters\s*</div>
- <div id="charactercount_field-info" class="govuk-hint govuk-character-count__message">\s*You can enter up to 200 characters\s*</div>
test_invalid_post:
request:
method: post
Expand All @@ -345,7 +345,7 @@ TestCharacterCountField:
- <p id="charactercount_field-error" class="govuk-error-message">\s*<span class="govuk-visually-hidden">\s*Error:\s*</span>\s*CharacterCountField is required\s*</p>
- <div class="govuk-form-group govuk-form-group--error">
- <div id="charactercount_field-hint" class="govuk-hint">\s*CharacterCountFieldHint\s*</div>
- <div id="charactercount_field-info" class="govuk-hint govuk-character-count__message" aria-live="polite">\s*You can enter up to 200 characters\s*</div>
- <div id="charactercount_field-info" class="govuk-hint govuk-character-count__message">\s*You can enter up to 200 characters\s*</div>

TestBooleanField:
template: "{{ form.boolean_field }}"
Expand Down Expand Up @@ -725,7 +725,7 @@ TestErrorSummary:
data:
foo: bar
expected_output:
- <div class="govuk-error-summary" aria-labelledby="error-summary-title" role="alert" tabindex="-1" data-module="govuk-error-summary">
- <div class="govuk-error-summary" aria-labelledby="error-summary-title" role="alert" data-module="govuk-error-summary">
- <h2 class="govuk-error-summary__title" id="error-summary-title">\s*There is a problem\s*</h2>
- <a href="#string_field">StringField is required</a>
- <a href="#date_field">Date is required</a>
Expand Down Expand Up @@ -802,6 +802,6 @@ TestErrorSummary:
charactercount_field: foo
float_field: 1.5
expected_output:
- <div class="govuk-error-summary" aria-labelledby="error-summary-title" role="alert" tabindex="-1" data-module="govuk-error-summary">
- <div class="govuk-error-summary" aria-labelledby="error-summary-title" role="alert" data-module="govuk-error-summary">
- <h2 class="govuk-error-summary__title" id="error-summary-title">\s*There is a problem\s*</h2>
- <a href="#string_field">Example serverside error - type &#34;John Smith&#34; into this field to suppress it</a>
12 changes: 5 additions & 7 deletions tests/requirements.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
deepmerge==1.0.1
email_validator==1.1.3
flask-wtf==1.0.0
flask==2.0.2
govuk-frontend-jinja==2.0.0
email_validator==1.2.1
flask-wtf==1.0.1
flask==2.1.3
govuk-frontend-jinja==2.3.0
pytest-cov==3.0.0
pyyaml==6.0
# Generated with piprot 0.9.10
# Looks like you've been keeping up to date, time for a delicious beverage!
pyyaml==6.0
38 changes: 21 additions & 17 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,39 @@
#
attrs==21.4.0
# via pytest
click==8.0.3
click==8.1.3
# via flask
coverage[toml]==6.2
coverage[toml]==6.4.2
# via pytest-cov
deepmerge==1.0.1
# via -r requirements.in
dnspython==2.1.0
dnspython==2.2.1
# via email-validator
email_validator==1.1.3
email-validator==1.2.1
# via -r requirements.in
flask==2.0.2
flask==2.1.3
# via
# -r requirements.in
# flask-wtf
flask-wtf==1.0.0
flask-wtf==1.0.1
# via -r requirements.in
govuk-frontend-jinja==2.0.0
govuk-frontend-jinja==2.3.0
# via -r requirements.in
idna==3.3
# via email-validator
importlib-metadata==4.12.0
# via flask
iniconfig==1.1.1
# via pytest
itsdangerous==2.0.1
itsdangerous==2.1.2
# via
# flask
# flask-wtf
jinja2==3.0.3
jinja2==3.1.2
# via
# flask
# govuk-frontend-jinja
markupsafe==2.0.1
markupsafe==2.1.1
# via
# jinja2
# wtforms
Expand All @@ -46,19 +48,21 @@ pluggy==1.0.0
# via pytest
py==1.11.0
# via pytest
pyparsing==3.0.6
pyparsing==3.0.9
# via packaging
pytest==6.2.5
pytest==7.1.2
# via pytest-cov
pytest-cov==3.0.0
# via -r requirements.in
pyyaml==6.0
# via -r requirements.in
toml==0.10.2
# via pytest
tomli==2.0.0
# via coverage
werkzeug==2.0.2
tomli==2.0.1
# via
# coverage
# pytest
werkzeug==2.1.2
# via flask
wtforms==3.0.1
# via flask-wtf
zipp==3.8.1
# via importlib-metadata

0 comments on commit de2042f

Please sign in to comment.