Skip to content

Commit

Permalink
Merge pull request #161 from philsherry/philsherry-inputradiogroup--w…
Browse files Browse the repository at this point in the history
…rapper-fix

Fix styling issue with error messages for inputRadioGroup
  • Loading branch information
oscarduignan committed Jun 18, 2021
2 parents bbcf7dc + 3189387 commit ea81194
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -24,11 +24,11 @@
@import views.html.helper._

@elements = @{new FieldElements(field.id, field, null, args.toMap, messages) }
@groupDivClass = {@elements.args.get('_groupDivClass)@if(elements.hasErrors){ form-field--error}}
@fieldsetClass = {@elements.args.get('_groupClass)}
@groupDivClass = {@elements.args.get('_groupDivClass)}
@fieldsetClass = {@elements.args.get('_groupClass)@if(elements.hasErrors){ form-field--error}}
@labelAfter = @{ elements.args.get('_labelAfter).getOrElse(false).asInstanceOf[Boolean] }

<div class="@groupDivClass">
@if(elements.args.get('_groupDivClass).isDefined) {<div class="@groupDivClass">}
<fieldset class="@fieldsetClass"
@if(elements.args.get('_fieldsetAttributes).isDefined) {@elements.args.get('_fieldsetAttributes)}>
@if(elements.args.get('_legend).isDefined) {
Expand Down Expand Up @@ -79,4 +79,4 @@
}
}
</fieldset>
</div>
@if(elements.args.get('_groupDivClass).isDefined) {</div>}
Expand Up @@ -113,7 +113,7 @@ class InputRadioGroupSpec extends WordSpec with Matchers with MessagesSupport {
value = None
)
val doc = jsoupDocument(inputRadioGroup(field, Seq("myValue" -> "myLabel"), '_inputClass -> "myInputClass"))
doc.getElementsByTag("div").first().attr("class") should include("form-field--error")
doc.getElementsByTag("fieldset").first().attr("class") should include("form-field--error")
doc.getElementsByClass("error-notification").first().text() shouldBe "too long"
}
}
Expand Down

0 comments on commit ea81194

Please sign in to comment.