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

Fix undefined classes in date input macro #410

Merged
merged 1 commit into from
Jan 5, 2018
Merged

Conversation

36degrees
Copy link
Contributor

When appending an undefined variable to an existing string, Nunjucks will add the string 'undefined' rather than failing silently. Because of this we need to test if item.classes is truthy when appending to avoid ending up with e.g.:

<input class="govuk-c-input govuk-c-date-input__input undefined" id="dob-day" name="dob-day" type="text">

https://trello.com/c/ZS93wLwG/532-fix-undefined-classes-when-using-date-macro-component

When appending an undefined variable to an existing string, Nunjucks will add the string 'undefined' rather than failing silently. Because of this we need to test if item.classes is truthy when appending to avoid ending up with e.g.:

`<input class="govuk-c-input govuk-c-date-input__input undefined" id="dob-day" name="dob-day" type="text">`
Copy link
Member

@hannalaakso hannalaakso left a comment

Choose a reason for hiding this comment

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

Works well. Good catch 👏

@36degrees 36degrees merged commit 7fee439 into master Jan 5, 2018
@36degrees 36degrees deleted the fix-undefined-classes branch January 5, 2018 10:33
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