gov_uk_date_fields 2.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e6c04db32bfffd44fa2c9422b5a754574a355a6
4
- data.tar.gz: 6d448753893db93d05cd2ada043ddc544e5d0146
3
+ metadata.gz: afc5da57c66f778875841732da87380f87ec678e
4
+ data.tar.gz: 6792f22278522a86820c02e5eeb44b36bf9fd96b
5
5
  SHA512:
6
- metadata.gz: f91dceba4ef129e4386c066b0ebdf4034f817b51599e5daa51e25165dbaf3deb8a928a2240ed454689715ef25905171f768fe0d2cfd550f355f6bba4f2b9b327
7
- data.tar.gz: 4c8da4674ae23e89fbaf809df6d7c345a74766a8cd5316dd00a6e84baafd8691348e7249b5b31082099fb1b5e6d77d911aa081e0b148b665c0448d13f0e2aea2
6
+ metadata.gz: b85d73e9bb5cbd97c31f165baa9b7d2933741b538a2b138f8f1ecb389adfe3fdcbe4d08a99d33eddd298fca9a04a103c15c00d1c032df753b2e94b11009d5574
7
+ data.tar.gz: b5f829f8aab24d51cb81fce92d06672a474d28c657955a4ea190a2a490c95e862b0d5708a7c80b3be79e2c52127715f684acbe3e23e89c3dfc47ba578c69bdca
@@ -66,25 +66,30 @@ module GovUkDateFields
66
66
  def generate_start_fieldset
67
67
  %Q|
68
68
  #{generate_fieldset_tag}
69
- #{generate_legend_tag}#{@options[:legend_text]}</legend>
70
- <div class="form-date">
69
+ #{generate_legend_tag}
70
+ <span class="form-label-bold">#{@options[:legend_text]}</span>
71
+ <span class="form-hint" id="#{@hint_id}">#{@form_hint_text}</span>
71
72
  #{generate_error_message}
72
- <p class="form-hint" id="#{@hint_id}">#{@form_hint_text}</p>
73
+ </legend>
74
+ <div class="form-date">
73
75
  |
74
76
  end
75
77
 
76
78
  def generate_fieldset_tag
77
- result = "<fieldset"
79
+ css_class = "form-group gov_uk_date"
80
+ css_class += " form-group-error" if error_for_attr?
81
+
82
+ result = %Q|
83
+ <div class="#{css_class}"|
78
84
  result += %Q| id="#{@fieldset_id}"| unless @fieldset_id.nil?
79
- css_class = "gov_uk_date"
80
- css_class += " error" if error_for_attr?
81
- result += %Q| class="#{css_class}"|
85
+ result += ">"
86
+ result += %Q| <fieldset|
82
87
  result += ">"
83
88
  result
84
89
  end
85
90
 
86
91
  def generate_end_fieldset
87
- "</div></fieldset>"
92
+ "</div></fieldset></div>"
88
93
  end
89
94
 
90
95
  def generate_legend_tag
@@ -139,28 +144,37 @@ module GovUkDateFields
139
144
  end
140
145
 
141
146
  def generate_day_input_field(day_value)
142
- %Q|
147
+ css_class = "form-control"
148
+ css_class += " form-control-error" if error_for_attr?
149
+
150
+ result = %Q|
143
151
  <div class="form-group form-group-day">
144
152
  <label for="#{html_id(:day)}">Day</label>
145
- <input class="form-control" id="#{html_id(:day)}" name="#{html_name(:day)}" type="number" min="0" max="31" aria-describedby="#{@hint_id}" value="#{day_value}">
153
+ <input class="#{css_class}" id="#{html_id(:day)}" name="#{html_name(:day)}" type="number" min="0" max="31" aria-describedby="#{@hint_id}" value="#{day_value}">
146
154
  </div>
147
155
  |
148
156
  end
149
157
 
150
158
  def generate_month_input_field(month_value)
151
- %Q|
159
+ css_class = "form-control"
160
+ css_class += " form-control-error" if error_for_attr?
161
+
162
+ result = %Q|
152
163
  <div class="form-group form-group-month">
153
164
  <label for="#{html_id(:month)}">Month</label>
154
- <input class="form-control" id="#{html_id(:month)}" name="#{html_name(:month)}" type="number" min="0" max="12" value="#{month_value}">
165
+ <input class="#{css_class}" id="#{html_id(:month)}" name="#{html_name(:month)}" type="number" min="0" max="12" value="#{month_value}">
155
166
  </div>
156
167
  |
157
168
  end
158
169
 
159
170
  def generate_year_input_field(year_value)
160
- %Q|
171
+ css_class = "form-control"
172
+ css_class += " form-control-error" if error_for_attr?
173
+
174
+ result = %Q|
161
175
  <div class="form-group form-group-year">
162
176
  <label for="#{html_id(:year)}">Year</label>
163
- <input class="form-control" id="#{html_id(:year)}" name="#{html_name(:year)}" type="number" min="0" max="2100" value="#{year_value}">
177
+ <input class="#{css_class}" id="#{html_id(:year)}" name="#{html_name(:year)}" type="number" min="0" max="2100" value="#{year_value}">
164
178
  </div>
165
179
  |
166
180
  end
@@ -1,3 +1,3 @@
1
1
  module GovUkDateFields
2
- VERSION = "2.2.0"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -14460,3 +14460,433 @@ DirectorTest: test_updating_existing_record_with_invalid_dates_is_valid_when_val
14460
14460
   (0.1ms) SAVEPOINT active_record_1
14461
14461
   (0.1ms) RELEASE SAVEPOINT active_record_1
14462
14462
   (0.1ms) ROLLBACK
14463
+ ActiveRecord::SchemaMigration Load (0.7ms) SELECT "schema_migrations".* FROM "schema_migrations"
14464
+  (0.3ms) BEGIN
14465
+ --------------------------------------------
14466
+ EmployeesControllerTest: test_should_get_new
14467
+ --------------------------------------------
14468
+  (0.2ms) SAVEPOINT active_record_1
14469
+ SQL (19.5ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", Tue, 13 Aug 1963], ["joined", Tue, 01 Apr 2014], ["created_at", 2018-05-03 10:08:46 UTC], ["updated_at", 2018-05-03 10:08:46 UTC]]
14470
+  (0.2ms) RELEASE SAVEPOINT active_record_1
14471
+  (0.2ms) SAVEPOINT active_record_1
14472
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", Mon, 17 May 1965], ["joined", Wed, 21 May 2014], ["created_at", 2018-05-03 10:08:46 UTC], ["updated_at", 2018-05-03 10:08:46 UTC]]
14473
+  (0.2ms) RELEASE SAVEPOINT active_record_1
14474
+ Processing by EmployeesController#new as HTML
14475
+ Rendering employees/new.html.erb within layouts/application
14476
+ Rendered employees/_form.html.erb (21.5ms)
14477
+ Rendered employees/new.html.erb within layouts/application (24.8ms)
14478
+ Completed 200 OK in 225ms (Views: 222.4ms | ActiveRecord: 0.0ms)
14479
+  (0.4ms) ROLLBACK
14480
+  (0.1ms) BEGIN
14481
+ -----------------------------------------------------
14482
+ EmployeesControllerTest: test_should_destroy_employee
14483
+ -----------------------------------------------------
14484
+  (0.2ms) SAVEPOINT active_record_1
14485
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", Tue, 13 Aug 1963], ["joined", Tue, 01 Apr 2014], ["created_at", 2018-05-03 10:08:46 UTC], ["updated_at", 2018-05-03 10:08:46 UTC]]
14486
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14487
+  (0.2ms) SAVEPOINT active_record_1
14488
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", Mon, 17 May 1965], ["joined", Wed, 21 May 2014], ["created_at", 2018-05-03 10:08:46 UTC], ["updated_at", 2018-05-03 10:08:46 UTC]]
14489
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14490
+  (12.3ms) SELECT COUNT(*) FROM "employees"
14491
+ Processing by EmployeesController#destroy as HTML
14492
+ Parameters: {"id"=>"683"}
14493
+ Employee Load (0.3ms) SELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT $2 [["id", 683], ["LIMIT", 1]]
14494
+  (0.1ms) SAVEPOINT active_record_1
14495
+ SQL (0.3ms) DELETE FROM "employees" WHERE "employees"."id" = $1 [["id", 683]]
14496
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14497
+ Redirected to http://test.host/employees
14498
+ Completed 302 Found in 6ms (ActiveRecord: 1.1ms)
14499
+  (0.2ms) SELECT COUNT(*) FROM "employees"
14500
+  (6.4ms) ROLLBACK
14501
+  (0.1ms) BEGIN
14502
+ ----------------------------------------------
14503
+ EmployeesControllerTest: test_should_get_index
14504
+ ----------------------------------------------
14505
+  (0.2ms) SAVEPOINT active_record_1
14506
+ SQL (1.2ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", Tue, 13 Aug 1963], ["joined", Tue, 01 Apr 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14507
+  (0.3ms) RELEASE SAVEPOINT active_record_1
14508
+  (0.2ms) SAVEPOINT active_record_1
14509
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", Mon, 17 May 1965], ["joined", Wed, 21 May 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14510
+  (0.2ms) RELEASE SAVEPOINT active_record_1
14511
+ Processing by EmployeesController#index as HTML
14512
+ Rendering employees/index.html.erb within layouts/application
14513
+ Employee Load (0.4ms) SELECT "employees".* FROM "employees"
14514
+ Rendered employees/index.html.erb within layouts/application (2.5ms)
14515
+ Completed 200 OK in 6ms (Views: 3.7ms | ActiveRecord: 0.4ms)
14516
+  (0.2ms) ROLLBACK
14517
+  (0.1ms) BEGIN
14518
+ ----------------------------------------------------
14519
+ EmployeesControllerTest: test_should_create_employee
14520
+ ----------------------------------------------------
14521
+  (0.1ms) SAVEPOINT active_record_1
14522
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", Tue, 13 Aug 1963], ["joined", Tue, 01 Apr 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14523
+  (0.2ms) RELEASE SAVEPOINT active_record_1
14524
+  (0.1ms) SAVEPOINT active_record_1
14525
+ SQL (0.2ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", Mon, 17 May 1965], ["joined", Wed, 21 May 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14526
+  (0.2ms) RELEASE SAVEPOINT active_record_1
14527
+  (0.2ms) SELECT COUNT(*) FROM "employees"
14528
+ Processing by EmployeesController#create as HTML
14529
+ Parameters: {"employee"=>{"dob_dd"=>"31", "dob_mm"=>"12", "dob_yyyy"=>"1965", "joined_dd"=>"4", "joined_mm"=>"mar", "joined_yyyy"=>"2015", "name"=>"Joe Blow"}}
14530
+  (0.1ms) SAVEPOINT active_record_1
14531
+ SQL (0.4ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Joe Blow"], ["dob", Fri, 31 Dec 1965], ["joined", Wed, 04 Mar 2015], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14532
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14533
+ Redirected to http://test.host/employees/689
14534
+ Completed 302 Found in 3ms (ActiveRecord: 0.7ms)
14535
+  (0.2ms) SELECT COUNT(*) FROM "employees"
14536
+  (0.3ms) SELECT COUNT(*) FROM "employees"
14537
+ Employee Load (0.3ms) SELECT "employees".* FROM "employees" ORDER BY "employees"."id" DESC LIMIT $1 [["LIMIT", 1]]
14538
+  (0.2ms) ROLLBACK
14539
+  (0.1ms) BEGIN
14540
+ ---------------------------------------------
14541
+ EmployeesControllerTest: test_should_get_edit
14542
+ ---------------------------------------------
14543
+  (0.2ms) SAVEPOINT active_record_1
14544
+ SQL (0.2ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", Tue, 13 Aug 1963], ["joined", Tue, 01 Apr 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14545
+  (0.2ms) RELEASE SAVEPOINT active_record_1
14546
+  (0.1ms) SAVEPOINT active_record_1
14547
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", Mon, 17 May 1965], ["joined", Wed, 21 May 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14548
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14549
+ Processing by EmployeesController#edit as HTML
14550
+ Parameters: {"id"=>"690"}
14551
+ Employee Load (0.3ms) SELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT $2 [["id", 690], ["LIMIT", 1]]
14552
+ Rendering employees/edit.html.erb within layouts/application
14553
+ Rendered employees/_form.html.erb (2.0ms)
14554
+ Rendered employees/edit.html.erb within layouts/application (2.6ms)
14555
+ Completed 200 OK in 7ms (Views: 4.3ms | ActiveRecord: 0.3ms)
14556
+  (0.2ms) ROLLBACK
14557
+  (0.1ms) BEGIN
14558
+ --------------------------------------------------------------
14559
+ EmployeesControllerTest: test_should_render_gov_uk_date_fields
14560
+ --------------------------------------------------------------
14561
+  (0.1ms) SAVEPOINT active_record_1
14562
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", Tue, 13 Aug 1963], ["joined", Tue, 01 Apr 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14563
+  (0.2ms) RELEASE SAVEPOINT active_record_1
14564
+  (0.1ms) SAVEPOINT active_record_1
14565
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", Mon, 17 May 1965], ["joined", Wed, 21 May 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14566
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14567
+ Processing by EmployeesController#edit as HTML
14568
+ Parameters: {"id"=>"692"}
14569
+ Employee Load (0.2ms) SELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT $2 [["id", 692], ["LIMIT", 1]]
14570
+ Rendering employees/edit.html.erb within layouts/application
14571
+ Rendered employees/_form.html.erb (2.3ms)
14572
+ Rendered employees/edit.html.erb within layouts/application (2.8ms)
14573
+ Completed 200 OK in 5ms (Views: 4.2ms | ActiveRecord: 0.2ms)
14574
+  (0.2ms) ROLLBACK
14575
+  (0.1ms) BEGIN
14576
+ --------------------------------------------------
14577
+ EmployeesControllerTest: test_should_show_employee
14578
+ --------------------------------------------------
14579
+  (0.2ms) SAVEPOINT active_record_1
14580
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", Tue, 13 Aug 1963], ["joined", Tue, 01 Apr 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14581
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14582
+  (0.2ms) SAVEPOINT active_record_1
14583
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", Mon, 17 May 1965], ["joined", Wed, 21 May 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14584
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14585
+ Processing by EmployeesController#show as HTML
14586
+ Parameters: {"id"=>"694"}
14587
+ Employee Load (0.3ms) SELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT $2 [["id", 694], ["LIMIT", 1]]
14588
+ Rendering employees/show.html.erb within layouts/application
14589
+ Rendered employees/show.html.erb within layouts/application (0.9ms)
14590
+ Completed 200 OK in 5ms (Views: 2.1ms | ActiveRecord: 0.3ms)
14591
+  (0.2ms) ROLLBACK
14592
+  (0.1ms) BEGIN
14593
+ ----------------------------------------------------
14594
+ EmployeesControllerTest: test_should_update_employee
14595
+ ----------------------------------------------------
14596
+  (0.2ms) SAVEPOINT active_record_1
14597
+ SQL (0.4ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", Tue, 13 Aug 1963], ["joined", Tue, 01 Apr 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14598
+  (0.2ms) RELEASE SAVEPOINT active_record_1
14599
+  (0.2ms) SAVEPOINT active_record_1
14600
+ SQL (1.4ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", Mon, 17 May 1965], ["joined", Wed, 21 May 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14601
+  (4.1ms) RELEASE SAVEPOINT active_record_1
14602
+ Processing by EmployeesController#update as HTML
14603
+ Parameters: {"employee"=>{"dob_dd"=>"1", "dob_mm"=>"11", "dob_yyyy"=>"1981", "joined_dd"=>"3", "joined_mm"=>"oct", "joined_yyyy"=>"2015", "name"=>"Ioannis Kole"}, "id"=>"696"}
14604
+ Employee Load (0.2ms) SELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT $2 [["id", 696], ["LIMIT", 1]]
14605
+  (0.2ms) SAVEPOINT active_record_1
14606
+ SQL (0.3ms) UPDATE "employees" SET "dob" = $1, "joined" = $2, "name" = $3, "updated_at" = $4 WHERE "employees"."id" = $5 [["dob", Sun, 01 Nov 1981], ["joined", Sat, 03 Oct 2015], ["name", "Ioannis Kole"], ["updated_at", 2018-05-03 10:08:47 UTC], ["id", 696]]
14607
+  (0.2ms) RELEASE SAVEPOINT active_record_1
14608
+ Redirected to http://test.host/employees/696
14609
+ Completed 302 Found in 4ms (ActiveRecord: 0.9ms)
14610
+ Employee Load (0.3ms) SELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT $2 [["id", 696], ["LIMIT", 1]]
14611
+  (0.2ms) ROLLBACK
14612
+  (0.2ms) BEGIN
14613
+ ----------------------------------------------------------------------
14614
+ OmitErrorClashEmployeeTest: test_valid_dates_generate_no_errors_at_all
14615
+ ----------------------------------------------------------------------
14616
+  (0.2ms) ROLLBACK
14617
+  (0.2ms) BEGIN
14618
+ -------------------------------------------------------------------------------------------------------
14619
+ OmitErrorClashEmployeeTest: test_invalid_day_does_not_add_invalid_date_message_to_cant_be_blank_message
14620
+ -------------------------------------------------------------------------------------------------------
14621
+  (0.1ms) ROLLBACK
14622
+  (0.1ms) BEGIN
14623
+ ------------------------------------------------------------------
14624
+ OmitErrorClashEmployeeTest: test_presence_error_messages_generated
14625
+ ------------------------------------------------------------------
14626
+  (0.2ms) ROLLBACK
14627
+  (0.1ms) BEGIN
14628
+ --------------------------------------------------------------------------------------------------
14629
+ DefaultErrorClashEmployeeTest: test_invalid_day_adds_invalid_date_message_to_cant_be_blank_message
14630
+ --------------------------------------------------------------------------------------------------
14631
+  (0.2ms) ROLLBACK
14632
+  (0.1ms) BEGIN
14633
+ ---------------------------------------------------------------------
14634
+ DefaultErrorClashEmployeeTest: test_presence_error_messages_generated
14635
+ ---------------------------------------------------------------------
14636
+  (0.1ms) ROLLBACK
14637
+  (0.1ms) BEGIN
14638
+ -------------------------------------------------------------------------
14639
+ DefaultErrorClashEmployeeTest: test_valid_dates_generate_no_errors_at_all
14640
+ -------------------------------------------------------------------------
14641
+  (0.1ms) ROLLBACK
14642
+  (0.1ms) BEGIN
14643
+ -------------------------------------------------------
14644
+ GovUkDateFieldsTest: test_basic_output_without_fieldset
14645
+ -------------------------------------------------------
14646
+  (0.1ms) ROLLBACK
14647
+  (0.1ms) BEGIN
14648
+ -------------------------------------------------------------------------------
14649
+ GovUkDateFieldsTest: test_fieldset_with_error_class_and_supplied_error_messages
14650
+ -------------------------------------------------------------------------------
14651
+  (0.1ms) ROLLBACK
14652
+  (0.1ms) BEGIN
14653
+ ---------------------------------------------------------------------------------------
14654
+ GovUkDateFieldsTest: test_fieldset_output_with_today_button_with_no_css_class_specified
14655
+ ---------------------------------------------------------------------------------------
14656
+  (0.2ms) ROLLBACK
14657
+  (0.1ms) BEGIN
14658
+ --------------------------------------------------------
14659
+ GovUkDateFieldsTest: test_fieldset_output_with_form_hint
14660
+ --------------------------------------------------------
14661
+  (0.1ms) ROLLBACK
14662
+  (0.1ms) BEGIN
14663
+ ----------------------------------------------------------------------------------
14664
+ GovUkDateFieldsTest: test_fieldset_output_with_today_button_with_css_class_applied
14665
+ ----------------------------------------------------------------------------------
14666
+  (0.2ms) ROLLBACK
14667
+  (0.1ms) BEGIN
14668
+ -----------------------------------------------------------
14669
+ GovUkDateFieldsTest: test_fieldset_output_with_legend_class
14670
+ -----------------------------------------------------------
14671
+  (0.2ms) ROLLBACK
14672
+  (0.1ms) BEGIN
14673
+ ------------------------------------------
14674
+ GovUkDateFieldsTest: test_fieldset_with_id
14675
+ ------------------------------------------
14676
+  (0.1ms) ROLLBACK
14677
+  (0.1ms) BEGIN
14678
+ -------------------------------------------------------------
14679
+ GovUkDateFieldsTest: test_placeholder_output_without_fieldset
14680
+ -------------------------------------------------------------
14681
+  (0.1ms) ROLLBACK
14682
+  (0.2ms) BEGIN
14683
+ ---------------------------------------------------------------
14684
+ GovUkDateFieldsTest: test_error_raised_if_invalid_options_given
14685
+ ---------------------------------------------------------------
14686
+  (0.1ms) ROLLBACK
14687
+  (0.1ms) BEGIN
14688
+ ---------------------------------------------------------------
14689
+ GovUkDateFieldsTest: test_fieldset_with_error_class_and_message
14690
+ ---------------------------------------------------------------
14691
+  (0.2ms) ROLLBACK
14692
+  (0.2ms) BEGIN
14693
+ -------------------------------------
14694
+ GovUkDateFieldsTest: test_squash_html
14695
+ -------------------------------------
14696
+  (0.2ms) ROLLBACK
14697
+  (0.1ms) BEGIN
14698
+ --------------------------------------------
14699
+ EmployeeTest: test_nil_dates_raise_no_errors
14700
+ --------------------------------------------
14701
+  (0.2ms) ROLLBACK
14702
+  (0.1ms) BEGIN
14703
+ -----------------------------------------------------------------
14704
+ EmployeeTest: test_employee_class_responds_to_acts_as_gov_uk_date
14705
+ -----------------------------------------------------------------
14706
+  (0.1ms) ROLLBACK
14707
+  (0.1ms) BEGIN
14708
+ -----------------------------------------------------------
14709
+ EmployeeTest: test_that_nil_can_be_assigned_to_a_date_field
14710
+ -----------------------------------------------------------
14711
+  (0.2ms) ROLLBACK
14712
+  (0.1ms) BEGIN
14713
+ -----------------------------------------------------------------------------------
14714
+ EmployeeTest: test_that_form_population_values_can_be_extracted_from_the_date_field
14715
+ -----------------------------------------------------------------------------------
14716
+  (0.1ms) ROLLBACK
14717
+  (0.1ms) BEGIN
14718
+ ------------------------------------------------------------------------
14719
+ EmployeeTest: test_creating_a_new_employee_with_invalid_dates_is_invalid
14720
+ ------------------------------------------------------------------------
14721
+  (0.1ms) ROLLBACK
14722
+  (0.1ms) BEGIN
14723
+ -------------------------------------------------------------------------------------------------------------------
14724
+ EmployeeTest: test_argument_error_is_raised_if_an_object_that_doesnt_respond_to_to_date_is_assigned_to_a_date_field
14725
+ -------------------------------------------------------------------------------------------------------------------
14726
+  (0.1ms) ROLLBACK
14727
+  (0.1ms) BEGIN
14728
+ -----------------------------------------------------------
14729
+ EmployeeTest: test_new_dates_can_be_populated_from_the_form
14730
+ -----------------------------------------------------------
14731
+  (0.2ms) ROLLBACK
14732
+  (0.1ms) BEGIN
14733
+ ------------------------------------------------------------------------------------------
14734
+ EmployeeTest: test_employee_instance_has_form_date_instance_variables_for_each_gov_uk_date
14735
+ ------------------------------------------------------------------------------------------
14736
+  (0.1ms) ROLLBACK
14737
+  (0.1ms) BEGIN
14738
+ ---------------------------------------------------------------------
14739
+ EmployeeTest: test_updating_existing_record_with_valid_dates_is_valid
14740
+ ---------------------------------------------------------------------
14741
+  (0.1ms) SAVEPOINT active_record_1
14742
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "John"], ["dob", Tue, 13 Aug 1963], ["joined", Mon, 21 Apr 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14743
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14744
+  (0.2ms) SAVEPOINT active_record_1
14745
+ SQL (0.3ms) UPDATE "employees" SET "dob" = $1, "updated_at" = $2 WHERE "employees"."id" = $3 [["dob", Mon, 17 May 1965], ["updated_at", 2018-05-03 10:08:47 UTC], ["id", 698]]
14746
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14747
+  (0.1ms) ROLLBACK
14748
+  (0.1ms) BEGIN
14749
+ ----------------------------------------------------------------------------------------------------------------
14750
+ EmployeeTest: test_that_the_calling_the_field_name_on_employee_will_return_the_date_part_of_the_form_date_object
14751
+ ----------------------------------------------------------------------------------------------------------------
14752
+  (0.1ms) ROLLBACK
14753
+  (0.1ms) BEGIN
14754
+ ----------------------------------------------------------------------------------------------
14755
+ EmployeeTest: test_no_argument_error_is_raised_if_parseable_string_is_assigned_to_a_date_field
14756
+ ----------------------------------------------------------------------------------------------
14757
+  (0.2ms) ROLLBACK
14758
+  (0.1ms) BEGIN
14759
+ ---------------------------------------------------------------------
14760
+ EmployeeTest: test_createing_a_new_employee_with_valid_dates_is_valid
14761
+ ---------------------------------------------------------------------
14762
+  (0.1ms) ROLLBACK
14763
+  (0.2ms) BEGIN
14764
+ -------------------------------------------
14765
+ EmployeeTest: test_invalid_day_raises_error
14766
+ -------------------------------------------
14767
+  (0.1ms) ROLLBACK
14768
+  (0.1ms) BEGIN
14769
+ -------------------------------------------------------------------------
14770
+ EmployeeTest: test_updating_existing_record_with_invalid_dates_is_invalid
14771
+ -------------------------------------------------------------------------
14772
+  (0.1ms) SAVEPOINT active_record_1
14773
+ SQL (0.2ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "John"], ["dob", Tue, 13 Aug 1963], ["joined", Mon, 21 Apr 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14774
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14775
+  (0.1ms) SAVEPOINT active_record_1
14776
+  (0.1ms) ROLLBACK TO SAVEPOINT active_record_1
14777
+  (0.2ms) ROLLBACK
14778
+  (0.1ms) BEGIN
14779
+ ----------------------------------------------
14780
+ EmployeeTest: test_valid_dates_raise_no_errors
14781
+ ----------------------------------------------
14782
+  (0.2ms) ROLLBACK
14783
+  (0.1ms) BEGIN
14784
+ ---------------------------------------------------------------------------------------------------------
14785
+ EmployeeTest: test_that_argument_error_is_raised_if_unparseable_string_object_is_assigned_to_a_date_field
14786
+ ---------------------------------------------------------------------------------------------------------
14787
+  (0.2ms) ROLLBACK
14788
+  (0.1ms) BEGIN
14789
+ --------------------------------------------------------------------------
14790
+ EmployeeTest: test_employee_has_class_variable_describing_all_gov_uk_dates
14791
+ --------------------------------------------------------------------------
14792
+  (0.1ms) ROLLBACK
14793
+  (0.1ms) BEGIN
14794
+ -----------------------------------------------------------------------
14795
+ EmployeeTest: test_that_we_can_assign_new_dates_to_the_form_date_object
14796
+ -----------------------------------------------------------------------
14797
+  (0.1ms) ROLLBACK
14798
+  (0.1ms) BEGIN
14799
+ -----------------------------------------------------------------------------------------
14800
+ GovUkDateFields::FormDateTest: test_set_from_date_instantiates_the_attribute_and_is_valid
14801
+ -----------------------------------------------------------------------------------------
14802
+  (0.1ms) ROLLBACK
14803
+  (0.1ms) BEGIN
14804
+ ------------------------------------------------------------------------------------------
14805
+ GovUkDateFields::FormDateTest: test_set_from_date_instantiates_a_nil_object_if_date_is_nil
14806
+ ------------------------------------------------------------------------------------------
14807
+  (0.2ms) ROLLBACK
14808
+  (0.1ms) BEGIN
14809
+ -------------------------------------------------------------------------------
14810
+ GovUkDateFields::FormDateTest: test_set_one_date_part_leaves_the_rest_unchanged
14811
+ -------------------------------------------------------------------------------
14812
+  (0.1ms) ROLLBACK
14813
+  (0.1ms) BEGIN
14814
+ ---------------------------------------------------------------------------------
14815
+ GovUkDateFields::FormDateTest: test_new_raises_error_if_called_from_outside_class
14816
+ ---------------------------------------------------------------------------------
14817
+  (0.1ms) ROLLBACK
14818
+  (0.1ms) BEGIN
14819
+ -----------------------------------------------------------------------------------------------
14820
+ GovUkDateFields::FormDateTest: test_setting_all_date_parts_to_nil_sets_date_to_nil_and_is_valid
14821
+ -----------------------------------------------------------------------------------------------
14822
+  (0.2ms) ROLLBACK
14823
+  (0.1ms) BEGIN
14824
+ ---------------------------------------------------------------------------------
14825
+ GovUkDateFields::FormDateTest: test_setting_all_three_date_parts_changes_the_date
14826
+ ---------------------------------------------------------------------------------
14827
+  (0.1ms) ROLLBACK
14828
+  (0.1ms) BEGIN
14829
+ ----------------------------------------------------------------------------------------------------------------------------------
14830
+ GovUkDateFields::FormDateTest: test_setting_date_parts_with_invalid_values_marks_date_as_invalid_and_leaves_date_variable_the_same
14831
+ ----------------------------------------------------------------------------------------------------------------------------------
14832
+  (0.1ms) ROLLBACK
14833
+  (0.1ms) BEGIN
14834
+ --------------------------------------------------------------------------------
14835
+ OverrideErrorClashEmployeeTest: test_invalid_day_overrides_cant_be_blank_message
14836
+ --------------------------------------------------------------------------------
14837
+  (0.1ms) ROLLBACK
14838
+  (0.1ms) BEGIN
14839
+ ----------------------------------------------------------------------
14840
+ OverrideErrorClashEmployeeTest: test_presence_error_messages_generated
14841
+ ----------------------------------------------------------------------
14842
+  (0.1ms) ROLLBACK
14843
+  (0.1ms) BEGIN
14844
+ --------------------------------------------------------------------------
14845
+ OverrideErrorClashEmployeeTest: test_valid_dates_generate_no_errors_at_all
14846
+ --------------------------------------------------------------------------
14847
+  (0.1ms) ROLLBACK
14848
+  (0.1ms) BEGIN
14849
+ -----------------------------------------------------------------
14850
+ DirectorTest: test_director_class_responds_to_acts_as_gov_uk_date
14851
+ -----------------------------------------------------------------
14852
+  (0.2ms) ROLLBACK
14853
+  (0.1ms) BEGIN
14854
+ --------------------------------------------------------------------------
14855
+ DirectorTest: test_director_has_class_variable_describing_all_gov_uk_dates
14856
+ --------------------------------------------------------------------------
14857
+  (0.1ms) ROLLBACK
14858
+  (0.1ms) BEGIN
14859
+ ------------------------------------------------------------------------------------------------
14860
+ DirectorTest: test_updating_existing_record_with_invalid_dates_is_valid_when_validation_disabled
14861
+ ------------------------------------------------------------------------------------------------
14862
+  (0.1ms) SAVEPOINT active_record_1
14863
+ SQL (0.3ms) INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "John"], ["dob", Tue, 13 Aug 1963], ["joined", Mon, 21 Apr 2014], ["created_at", 2018-05-03 10:08:47 UTC], ["updated_at", 2018-05-03 10:08:47 UTC]]
14864
+  (0.1ms) RELEASE SAVEPOINT active_record_1
14865
+  (0.1ms) SAVEPOINT active_record_1
14866
+  (0.2ms) RELEASE SAVEPOINT active_record_1
14867
+  (0.1ms) ROLLBACK
14868
+  (0.1ms) BEGIN
14869
+ -----------------------------------------------------------------------
14870
+ DirectorTest: test_valid_dates_raise_no_errors_when_validation_disabled
14871
+ -----------------------------------------------------------------------
14872
+  (0.1ms) ROLLBACK
14873
+  (0.1ms) BEGIN
14874
+ -----------------------------------------------------------------------------------------------
14875
+ DirectorTest: test_creating_a_new_director_with_invalid_dates_is_valid_when_validation_disabled
14876
+ -----------------------------------------------------------------------------------------------
14877
+  (0.1ms) ROLLBACK
14878
+  (0.1ms) BEGIN
14879
+ -----------------------------------------------------------------------
14880
+ DirectorTest: test_invalid_day_raises_no_error_when_validation_disabled
14881
+ -----------------------------------------------------------------------
14882
+  (0.1ms) ROLLBACK
14883
+  (0.1ms) BEGIN
14884
+ ---------------------------------------------------------------------
14885
+ DirectorTest: test_nil_dates_raise_no_errors_when_validation_disabled
14886
+ ---------------------------------------------------------------------
14887
+  (0.1ms) ROLLBACK
14888
+  (0.1ms) BEGIN
14889
+ ----------------------------------------------
14890
+ ReplicantTest: test_joined_date_is_same_as_dob
14891
+ ----------------------------------------------
14892
+  (0.2ms) ROLLBACK
@@ -103,149 +103,171 @@ class GovUkDateFieldsTest < ActiveSupport::TestCase
103
103
 
104
104
  def expected_fieldset_output_with_error_class_and_message
105
105
  %Q{
106
- <fieldset id="employee_date_joined" class="gov_uk_date error">
107
- <legend>Joining date</legend>
108
- <div class="form-date">
109
- <ul>
110
- <li>
111
- <span class="error-message">Invalid joining date</span>
112
- </li>
113
- <li>
114
- <span class="error-message">Joining date must be in the past</span>
115
- </li>
116
- </ul>
117
- <p class="form-hint" id="employee_date_joined-hint">For example, 31 3 1980</p>
118
- <div class="form-group form-group-day">
119
- <label for="employee_joined_dd">Day</label>
120
- <input class="form-control" id="employee_joined_dd" name="employee[joined_dd]" type="number" min="0" max="31" aria-describedby="employee_date_joined-hint" value="1">
121
- </div>
122
- <div class="form-group form-group-month">
123
- <label for="employee_joined_mm">Month</label>
124
- <input class="form-control" id="employee_joined_mm" name="employee[joined_mm]" type="number" min="0" max="12" value="4">
125
- </div>
126
- <div class="form-group form-group-year">
127
- <label for="employee_joined_yyyy">Year</label>
128
- <input class="form-control" id="employee_joined_yyyy" name="employee[joined_yyyy]" type="number" min="0" max="2100" value="2015">
106
+ <div class="form-group gov_uk_date form-group-error" id="employee_date_joined">
107
+ <fieldset>
108
+ <legend>
109
+ <span class="form-label-bold">Joining date</span>
110
+ <span class="form-hint" id="employee_date_joined-hint">
111
+ For example, 31 3 1980
112
+ </span>
113
+ <ul>
114
+ <li><span class="error-message">Invalid joining date</span></li>
115
+ <li><span class="error-message">Joining date must be in the past</span></li>
116
+ </ul>
117
+ </legend>
118
+ <div class="form-date">
119
+ <div class="form-group form-group-day">
120
+ <label for="employee_joined_dd">Day</label>
121
+ <input class="form-control form-control-error" id="employee_joined_dd" name="employee[joined_dd]" type="number" min="0" max="31" aria-describedby="employee_date_joined-hint" value="1">
122
+ </div>
123
+ <div class="form-group form-group-month">
124
+ <label for="employee_joined_mm">Month</label>
125
+ <input class="form-control form-control-error" id="employee_joined_mm" name="employee[joined_mm]" type="number" min="0" max="12" value="4">
126
+ </div>
127
+ <div class="form-group form-group-year">
128
+ <label for="employee_joined_yyyy">Year</label>
129
+ <input class="form-control form-control-error" id="employee_joined_yyyy" name="employee[joined_yyyy]" type="number" min="0" max="2100" value="2015">
130
+ </div>
129
131
  </div>
130
- </div>
131
- </fieldset>
132
+ </fieldset>
133
+ </div>
132
134
  }
133
135
  end
134
136
 
135
137
  def expected_fieldset_output_with_id
136
138
  %Q{
137
- <fieldset id="employee_date_joined" class="gov_uk_date">
138
- <legend>Joining date</legend>
139
- <div class="form-date">
140
- <p class="form-hint" id="employee_date_joined-hint">For example, 31 3 1980</p>
141
- <div class="form-group form-group-day">
142
- <label for="employee_joined_dd">Day</label>
143
- <input class="form-control" id="employee_joined_dd" name="employee[joined_dd]" type="number" min="0" max="31" aria-describedby="employee_date_joined-hint" value="1">
144
- </div>
145
- <div class="form-group form-group-month">
146
- <label for="employee_joined_mm">Month</label>
147
- <input class="form-control" id="employee_joined_mm" name="employee[joined_mm]" type="number" min="0" max="12" value="4">
148
- </div>
149
- <div class="form-group form-group-year">
150
- <label for="employee_joined_yyyy">Year</label>
151
- <input class="form-control" id="employee_joined_yyyy" name="employee[joined_yyyy]" type="number" min="0" max="2100" value="2015">
139
+ <div class="form-group gov_uk_date" id="employee_date_joined">
140
+ <fieldset>
141
+ <legend>
142
+ <span class="form-label-bold">Joining date</span>
143
+ <span class="form-hint" id="employee_date_joined-hint">For example, 31 3 1980</span>
144
+ </legend>
145
+ <div class="form-date">
146
+ <div class="form-group form-group-day">
147
+ <label for="employee_joined_dd">Day</label>
148
+ <input class="form-control" id="employee_joined_dd" name="employee[joined_dd]" type="number" min="0" max="31" aria-describedby="employee_date_joined-hint" value="1">
149
+ </div>
150
+ <div class="form-group form-group-month">
151
+ <label for="employee_joined_mm">Month</label>
152
+ <input class="form-control" id="employee_joined_mm" name="employee[joined_mm]" type="number" min="0" max="12" value="4">
153
+ </div>
154
+ <div class="form-group form-group-year">
155
+ <label for="employee_joined_yyyy">Year</label>
156
+ <input class="form-control" id="employee_joined_yyyy" name="employee[joined_yyyy]" type="number" min="0" max="2100" value="2015">
157
+ </div>
152
158
  </div>
153
- </div>
154
- </fieldset>
159
+ </fieldset>
160
+ </div>
155
161
  }
156
162
  end
157
163
 
158
164
  def expected_fieldset_output_with_form_hint
159
165
  %Q{
160
- <fieldset class="gov_uk_date">
161
- <legend class="govuk_legend_class">Date of birth</legend>
162
- <div class="form-date">
163
- <p class="form-hint" id="dob-hint">In the form: dd mm yyyy</p>
164
- <div class="form-group form-group-day">
165
- <label for="employee_dob_dd">Day</label>
166
- <input class="form-control" id="employee_dob_dd" name="employee[dob_dd]" type="number" min="0" max="31" aria-describedby="dob-hint" value="7">
167
- </div>
168
- <div class="form-group form-group-month">
169
- <label for="employee_dob_mm">Month</label>
170
- <input class="form-control" id="employee_dob_mm" name="employee[dob_mm]" type="number" min="0" max="12" value="12">
171
- </div>
172
- <div class="form-group form-group-year">
173
- <label for="employee_dob_yyyy">Year</label>
174
- <input class="form-control" id="employee_dob_yyyy" name="employee[dob_yyyy]" type="number" min="0" max="2100" value="1963">
166
+ <div class="form-group gov_uk_date">
167
+ <fieldset>
168
+ <legend class="govuk_legend_class">
169
+ <span class="form-label-bold">Date of birth</span>
170
+ <span class="form-hint" id="dob-hint">In the form: dd mm yyyy</span>
171
+ </legend>
172
+ <div class="form-date">
173
+ <div class="form-group form-group-day">
174
+ <label for="employee_dob_dd">Day</label>
175
+ <input class="form-control" id="employee_dob_dd" name="employee[dob_dd]" type="number" min="0" max="31" aria-describedby="dob-hint" value="7">
176
+ </div>
177
+ <div class="form-group form-group-month">
178
+ <label for="employee_dob_mm">Month</label>
179
+ <input class="form-control" id="employee_dob_mm" name="employee[dob_mm]" type="number" min="0" max="12" value="12">
180
+ </div>
181
+ <div class="form-group form-group-year">
182
+ <label for="employee_dob_yyyy">Year</label>
183
+ <input class="form-control" id="employee_dob_yyyy" name="employee[dob_yyyy]" type="number" min="0" max="2100" value="1963">
184
+ </div>
175
185
  </div>
176
- </div>
177
- </fieldset>
186
+ </fieldset>
187
+ </div>
178
188
  }
179
189
  end
180
190
 
181
191
  def expected_fieldset_output_with_legend_class
182
192
  %Q{
183
- <fieldset class="gov_uk_date">
184
- <legend class="date-legend-class">Joining date</legend>
185
- <div class="form-date">
186
- <p class="form-hint" id="joined-hint">For example, 31 3 1980</p>
187
- <div class="form-group form-group-day">
188
- <label for="employee_joined_dd">Day</label>
189
- <input class="form-control" id="employee_joined_dd" name="employee[joined_dd]" type="number" min="0" max="31" aria-describedby="joined-hint" value="1">
190
- </div>
191
- <div class="form-group form-group-month">
192
- <label for="employee_joined_mm">Month</label>
193
- <input class="form-control" id="employee_joined_mm" name="employee[joined_mm]" type="number" min="0" max="12" value="4">
194
- </div>
195
- <div class="form-group form-group-year">
196
- <label for="employee_joined_yyyy">Year</label>
197
- <input class="form-control" id="employee_joined_yyyy" name="employee[joined_yyyy]" type="number" min="0" max="2100" value="2015">
193
+ <div class="form-group gov_uk_date">
194
+ <fieldset>
195
+ <legend class="date-legend-class">
196
+ <span class="form-label-bold">Joining date</span>
197
+ <span class="form-hint" id="joined-hint">For example, 31 3 1980</span>
198
+ </legend>
199
+ <div class="form-date">
200
+ <div class="form-group form-group-day">
201
+ <label for="employee_joined_dd">Day</label>
202
+ <input class="form-control" id="employee_joined_dd" name="employee[joined_dd]" type="number" min="0" max="31" aria-describedby="joined-hint" value="1">
203
+ </div>
204
+ <div class="form-group form-group-month">
205
+ <label for="employee_joined_mm">Month</label>
206
+ <input class="form-control" id="employee_joined_mm" name="employee[joined_mm]" type="number" min="0" max="12" value="4">
207
+ </div>
208
+ <div class="form-group form-group-year">
209
+ <label for="employee_joined_yyyy">Year</label>
210
+ <input class="form-control" id="employee_joined_yyyy" name="employee[joined_yyyy]" type="number" min="0" max="2100" value="2015">
211
+ </div>
198
212
  </div>
199
- </div>
200
- </fieldset>
213
+ </fieldset>
214
+ </div>
201
215
  }
202
216
  end
203
217
 
204
218
  def expected_fieldset_output_with_unstyled_today_button
205
219
  %Q{
206
- <fieldset id="employee_date_joined" class="gov_uk_date">
207
- <legend>Joining date</legend>
208
- <div class="form-date">
209
- <p class="form-hint" id="employee_date_joined-hint">For example, 31 3 1980</p>
210
- <a class="button" role="button" href="#">Today</a>
211
- <div class="form-group form-group-day">
212
- <label for="employee_joined_dd">Day</label>
213
- <input class="form-control" id="employee_joined_dd" name="employee[joined_dd]" type="number" min="0" max="31" aria-describedby="employee_date_joined-hint" value="1">
220
+ <div class="form-group gov_uk_date" id="employee_date_joined">
221
+ <fieldset>
222
+ <legend>
223
+ <span class="form-label-bold">Joining date</span>
224
+ <span class="form-hint" id="employee_date_joined-hint">For example, 31 3 1980</span>
225
+ </legend>
226
+ <div class="form-date">
227
+ <a class="button" role="button" href="#">Today</a>
228
+ <div class="form-group form-group-day">
229
+ <label for="employee_joined_dd">Day</label>
230
+ <input class="form-control" id="employee_joined_dd" name="employee[joined_dd]" type="number" min="0" max="31" aria-describedby="employee_date_joined-hint" value="1">
231
+ </div>
232
+ <div class="form-group form-group-month">
233
+ <label for="employee_joined_mm">Month</label>
234
+ <input class="form-control" id="employee_joined_mm" name="employee[joined_mm]" type="number" min="0" max="12" value="4">
235
+ </div>
236
+ <div class="form-group form-group-year">
237
+ <label for="employee_joined_yyyy">Year</label>
238
+ <input class="form-control" id="employee_joined_yyyy" name="employee[joined_yyyy]" type="number" min="0" max="2100" value="2015">
239
+ </div>
214
240
  </div>
215
- <div class="form-group form-group-month">
216
- <label for="employee_joined_mm">Month</label>
217
- <input class="form-control" id="employee_joined_mm" name="employee[joined_mm]" type="number" min="0" max="12" value="4">
218
- </div>
219
- <div class="form-group form-group-year">
220
- <label for="employee_joined_yyyy">Year</label>
221
- <input class="form-control" id="employee_joined_yyyy" name="employee[joined_yyyy]" type="number" min="0" max="2100" value="2015">
222
- </div>
223
- </div>
224
- </fieldset>
241
+ </fieldset>
242
+ </div>
225
243
  }
226
244
  end
227
245
 
228
246
  def expected_fieldset_output_with_syled_today_button
229
247
  %Q{
230
- <fieldset id="employee_date_joined" class="gov_uk_date">
231
- <legend>Joining date</legend>
232
- <div class="form-date">
233
- <p class="form-hint" id="employee_date_joined-hint">For example, 31 3 1980</p>
234
- <a class="today-button-class" role="button" href="#">Today</a>
235
- <div class="form-group form-group-day">
236
- <label for="employee_joined_dd">Day</label>
237
- <input class="form-control" id="employee_joined_dd" name="employee[joined_dd]" type="number" min="0" max="31" aria-describedby="employee_date_joined-hint" value="1">
238
- </div>
239
- <div class="form-group form-group-month">
240
- <label for="employee_joined_mm">Month</label>
241
- <input class="form-control" id="employee_joined_mm" name="employee[joined_mm]" type="number" min="0" max="12" value="4">
242
- </div>
243
- <div class="form-group form-group-year">
244
- <label for="employee_joined_yyyy">Year</label>
245
- <input class="form-control" id="employee_joined_yyyy" name="employee[joined_yyyy]" type="number" min="0" max="2100" value="2015">
248
+ <div class="form-group gov_uk_date" id="employee_date_joined">
249
+ <fieldset>
250
+ <legend>
251
+ <span class="form-label-bold">Joining date</span>
252
+ <span class="form-hint" id="employee_date_joined-hint">For example, 31 3 1980</span>
253
+ </legend>
254
+ <div class="form-date">
255
+ <a class="today-button-class" role="button" href="#">Today</a>
256
+ <div class="form-group form-group-day">
257
+ <label for="employee_joined_dd">Day</label>
258
+ <input class="form-control" id="employee_joined_dd" name="employee[joined_dd]" type="number" min="0" max="31" aria-describedby="employee_date_joined-hint" value="1">
259
+ </div>
260
+ <div class="form-group form-group-month">
261
+ <label for="employee_joined_mm">Month</label>
262
+ <input class="form-control" id="employee_joined_mm" name="employee[joined_mm]" type="number" min="0" max="12" value="4">
263
+ </div>
264
+ <div class="form-group form-group-year">
265
+ <label for="employee_joined_yyyy">Year</label>
266
+ <input class="form-control" id="employee_joined_yyyy" name="employee[joined_yyyy]" type="number" min="0" max="2100" value="2015">
267
+ </div>
246
268
  </div>
247
- </div>
248
- </fieldset>
269
+ </fieldset>
270
+ </div>
249
271
  }
250
272
  end
251
273
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gov_uk_date_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Richards