Commit ad1d631
authored
Port FormBuilder from Rails template (#61)
- Add capybara for html rspec matchers
- Port over USWDSFormBuilder to Flex::FormBuilder
- Add memorable_date function to form builder
## Context
I think the form builder makes more sense in the flex module because:
1. We already have a case where a function we want to add to form
builder (memorable_date) relies on Flex functionality (the
memorable_date flex_attribute)
2. Over time it would be nice to add more functionality to the form
builder that extends beyond the basic building blocks from USWDS. For
example we'd want to be able to generate form elements for other
flex_attributes like full_name, address, etc.
This form builder is a straight port of USWDSFormBuilder with the
following changes:
1. Namespaced to Flex module
2. Scoped content strings to flex.*
3. Renamed helper method from us_form_with to flex_form_with
Note: the added capybara gem is for rspec html matchers like
"expect(html_string).to have_element(...)"1 parent e3bc037 commit ad1d631
13 files changed
Lines changed: 821 additions & 5 deletions
File tree
- app
- helpers/flex
- lib/flex
- previews/flex
- views/flex/previews
- config/locales/flex
- lib/flex
- spec
- dummy
- config/initializers
- spec/lib/flex
- helpers/flex
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
88 | 97 | | |
89 | 98 | | |
90 | 99 | | |
| |||
161 | 170 | | |
162 | 171 | | |
163 | 172 | | |
| 173 | + | |
164 | 174 | | |
165 | 175 | | |
166 | 176 | | |
| |||
356 | 366 | | |
357 | 367 | | |
358 | 368 | | |
| 369 | + | |
| 370 | + | |
359 | 371 | | |
360 | 372 | | |
361 | 373 | | |
| |||
371 | 383 | | |
372 | 384 | | |
373 | 385 | | |
| 386 | + | |
374 | 387 | | |
375 | 388 | | |
376 | 389 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
0 commit comments