-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from gobuffalo/task-allowing-wrapper-class
Allowing to specify the bootstrap form class
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package bootstrap_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gobuffalo/tags" | ||
"github.com/gobuffalo/tags/form/bootstrap" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_BootstrapFormGroupClass(t *testing.T) { | ||
r := require.New(t) | ||
f := bootstrap.NewFormFor(struct{ Name string }{}, tags.Options{}) | ||
|
||
tcases := []struct { | ||
options tags.Options | ||
expected string | ||
}{ | ||
{ | ||
expected: `<div class="form-group row"><label>Name</label><input class=" form-control" id="-Name" name="Name" type="text" value="" /></div>`, | ||
options: tags.Options{ | ||
"bootstrap": map[string]interface{}{ | ||
"form-group-class": "form-group row", | ||
}, | ||
}, | ||
}, | ||
|
||
{ | ||
expected: `<div class="form-group"><label>Name</label><input class=" form-control" id="-Name" name="Name" type="text" value="" /></div>`, | ||
options: tags.Options{}, | ||
}, | ||
} | ||
|
||
for _, tcase := range tcases { | ||
l := f.InputTag("Name", tcase.options) | ||
r.Equal(tcase.expected, l.String()) | ||
} | ||
|
||
} |
This file contains 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