Skip to content

Commit

Permalink
CCMSPUI-468 | Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arunkumar461 committed Jan 4, 2025
1 parent 363e166 commit a408ef3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public record DatePickerAttributes(
String maxDate) {

public boolean hasError() {
return !errorMessage.isEmpty();
return errorMessage != null && !errorMessage.isBlank();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ void shouldRenderGovukButton() {
"Please enter a valid date of birth.</p><input class=\"govuk-input moj-js-datepicker-input " +
"govuk-input--error\" id=\"dob\" name=\"dateOfBirth\" type=\"text\" " +
"aria-describedby=\"dob-hint dob-error\" value=\"2024-01-01\" autocomplete=\"off\">" +
"</div></div>");
"</div></div>")
.contains(
"<div class=\"moj-datepicker\" data-module=\"moj-date-picker\" " +
"data-min-date=\"2000-01-01\" data-max-date=\"2025-12-31\">" +
"<div class=\"govuk-form-group\"><label class=\"govuk-label\" " +
"for=\"dob\">Date of Birth</label><div id=\"dob-hint\" " +
"class=\"govuk-hint\">For example, 01/01/2000.</div><input " +
"class=\"govuk-input moj-js-datepicker-input\" id=\"dob\" name=\"dateOfBirth\" " +
"type=\"text\" aria-describedby=\"dob-hint\" value=\"2024-01-01\" " +
"autocomplete=\"off\"></div></div>");

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,15 @@
value="2024-01-01">
</moj:datepicker>

<moj:datepicker
id="dob"
name="dateOfBirth"
label="Date of Birth"
hint="For example, 01/01/2000."
minDate="2000-01-01"
maxDate="2025-12-31"
value="2024-01-01">
</moj:datepicker>

</body>
</html>

0 comments on commit a408ef3

Please sign in to comment.