Created
February 13, 2016 12:20
-
-
Save NTCoding/f0174891b0738d035365 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| behavior of "conditional mappings" | |
| it should "contain field level errors for fields using conditional mappings" in { | |
| val data = Map("nonUkResident" -> "true") | |
| val res = form.bind(data) | |
| assert(res.errors.length == 2) | |
| assert(res.errors.head.key === "country") | |
| assert(res.errors.tail.head.key === "email") | |
| } | |
| lazy val form = Form(mapping( | |
| "nonUkResident" -> boolean, | |
| "country" -> mandatoryIfTrue("nonUkResident", nonEmptyText), | |
| "email" -> nonEmptyText | |
| )(Model.apply)(Model.unapply)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment