Skip to content

Commit

Permalink
solving conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Walderman committed Oct 8, 2019
2 parents 746cfa8 + 9ed2f79 commit 00493cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
4 changes: 2 additions & 2 deletions form/checkbox_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ func (f Form) CheckboxTag(opts tags.Options) *tags.Tag {
if opts["tag_only"] == true {
delete(opts, "label")
ct := f.InputTag(opts)
ct.Checked = isChecked
ct.Checked = isChecked && template.HTMLEscaper(value) == template.HTMLEscaper(checked)
return ct
}

tag := tags.New("label", tags.Options{})
ct := f.InputTag(opts)
ct.Checked = isChecked
ct.Checked = isChecked && template.HTMLEscaper(value) == template.HTMLEscaper(checked)
tag.Append(ct)

if opts["name"] != nil && unchecked != nil {
Expand Down
11 changes: 0 additions & 11 deletions form/checkbox_tag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,6 @@ func Test_Form_CheckboxTag_With_Empty_Text_Value(t *testing.T) {
r.Equal(`<label><input name="Chubby" type="checkbox" value="" /></label>`, ct.String())
}

func Test_Form_CheckboxTag_With_Empty_Text_Value_Unchecked(t *testing.T) {
r := require.New(t)
f := form.New(tags.Options{})
ct := f.CheckboxTag(tags.Options{
"name": "Chubby",
"value": "",
"unchecked": "",
})
r.Equal(`<label><input name="Chubby" type="checkbox" value="" /><input name="Chubby" type="hidden" value="" /></label>`, ct.String())
}

func Test_Form_CheckboxTag_TagOnly_With_CustomValue(t *testing.T) {
r := require.New(t)
f := form.New(tags.Options{})
Expand Down

0 comments on commit 00493cd

Please sign in to comment.