Skip to content

Commit

Permalink
Add mode test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Walderman committed Oct 18, 2019
1 parent a5d0e75 commit d925cd5
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion form/bootstrap/form_for_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ func Test_Field_Boolean(t *testing.T) {
},
output: `<input class="custom-input" id="-IsAdmin" name="IsAdmin" type="checkbox" value="true" />`,
},

{
Value: true,
name: "IsAdmin",
Expand All @@ -365,6 +364,26 @@ func Test_Field_Boolean(t *testing.T) {
},
output: `<input class="custom-input" id="-IsAdmin" name="IsAdmin" type="checkbox" value="true" checked />`,
},
{
Value: false,
name: "IsAdmin",
opts: tags.Options{},
output: `<div class="form-group"><label><input class="" id="-IsAdmin" name="IsAdmin" type="checkbox" value="true" /> IsAdmin</label></div>`,
},
{
Value: true,
name: "IsAdmin",
opts: tags.Options{},
output: `<div class="form-group"><label><input class="" id="-IsAdmin" name="IsAdmin" type="checkbox" value="true" checked /> IsAdmin</label></div>`,
},
{
Value: false,
name: "IsAdmin",
opts: tags.Options{
"unchecked": false,
},
output: `<div class="form-group"><label><input class="" id="-IsAdmin" name="IsAdmin" type="checkbox" value="true" /><input name="IsAdmin" type="hidden" value="false" /> IsAdmin</label></div>`,
},
}

for index, tcase := range cases {
Expand Down

0 comments on commit d925cd5

Please sign in to comment.