diff --git a/lib/gov_uk_date_fields/form_fields.rb b/lib/gov_uk_date_fields/form_fields.rb index 53e2bc9..588a12e 100644 --- a/lib/gov_uk_date_fields/form_fields.rb +++ b/lib/gov_uk_date_fields/form_fields.rb @@ -66,25 +66,30 @@ def generate_old_style_input_fields def generate_start_fieldset %Q| #{generate_fieldset_tag} - #{generate_legend_tag}#{@options[:legend_text]} -
+ #{generate_legend_tag} + #{@options[:legend_text]} + #{@form_hint_text} #{generate_error_message} -

#{@form_hint_text}

+ +
| end def generate_fieldset_tag - result = "" + "
" end def generate_legend_tag @@ -139,28 +144,37 @@ def generate_end_div end def generate_day_input_field(day_value) - %Q| + css_class = "form-control" + css_class += " form-control-error" if error_for_attr? + + result = %Q|
- +
| end def generate_month_input_field(month_value) - %Q| + css_class = "form-control" + css_class += " form-control-error" if error_for_attr? + + result = %Q|
- +
| end def generate_year_input_field(year_value) - %Q| + css_class = "form-control" + css_class += " form-control-error" if error_for_attr? + + result = %Q|
- +
| end diff --git a/test/dummy/test/models/form_fields_test.rb b/test/dummy/test/models/form_fields_test.rb index 38f83e0..bf39340 100644 --- a/test/dummy/test/models/form_fields_test.rb +++ b/test/dummy/test/models/form_fields_test.rb @@ -103,149 +103,171 @@ def expected_placeholder_output_without_fieldset def expected_fieldset_output_with_error_class_and_message %Q{ -
- Joining date -
- -

For example, 31 3 1980

-
- - -
-
- - -
-
- - +
+
+ + Joining date + + For example, 31 3 1980 + +
    +
  • Invalid joining date
  • +
  • Joining date must be in the past
  • +
+
+
+
+ + +
+
+ + +
+
+ + +
-
-
+ + } end def expected_fieldset_output_with_id %Q{ -
- Joining date -
-

For example, 31 3 1980

-
- - -
-
- - -
-
- - +
+
+ + Joining date + For example, 31 3 1980 + +
+
+ + +
+
+ + +
+
+ + +
-
-
+ + } end def expected_fieldset_output_with_form_hint %Q{ -
- Date of birth -
-

In the form: dd mm yyyy

-
- - -
-
- - -
-
- - +
+
+ + Date of birth + In the form: dd mm yyyy + +
+
+ + +
+
+ + +
+
+ + +
-
-
+ + } end def expected_fieldset_output_with_legend_class %Q{ -
- Joining date -
-

For example, 31 3 1980

-
- - -
-
- - -
-
- - +
+
+ + Joining date + For example, 31 3 1980 + +
+
+ + +
+
+ + +
+
+ + +
-
-
+ + } end def expected_fieldset_output_with_unstyled_today_button %Q{ -
- Joining date -
-

For example, 31 3 1980

- Today -
- - +
+
+ + Joining date + For example, 31 3 1980 + +
+ Today +
+ + +
+
+ + +
+
+ + +
-
- - -
-
- - -
-
-
+ + } end def expected_fieldset_output_with_syled_today_button %Q{ -
- Joining date -
-

For example, 31 3 1980

- Today -
- - -
-
- - -
-
- - +
+
+ + Joining date + For example, 31 3 1980 + +
+ Today +
+ + +
+
+ + +
+
+ + +
-
-
+ + } end