diff --git a/Gemfile.lock b/Gemfile.lock index 90f8b5d..629aae8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - govuk_elements_form_builder (1.1.0) + govuk_elements_form_builder (1.2.0) govuk_elements_rails (>= 3.0.0) govuk_frontend_toolkit (>= 6.0.0) rails (>= 4.2) @@ -50,20 +50,21 @@ GEM codeclimate-test-reporter (0.6.0) simplecov (>= 0.7.1, < 1.0.0) coderay (1.1.1) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.4) + crass (1.0.4) diff-lcs (1.2.5) docile (1.1.5) erubis (2.7.0) ffi (1.9.10) formatador (0.2.5) - globalid (0.4.0) + globalid (0.4.2) activesupport (>= 4.2.0) - govuk_elements_rails (3.0.2) - govuk_frontend_toolkit (>= 5.2.0) + govuk_elements_rails (3.1.3) + govuk_frontend_toolkit (>= 6.0.2) rails (>= 4.1.0) sass (>= 3.2.0) - govuk_frontend_toolkit (6.0.1) - rails (>= 3.1.0) + govuk_frontend_toolkit (8.1.0) + railties (>= 3.1.0) sass (>= 3.2.0) guard (2.13.0) formatador (>= 0.2.4) @@ -80,25 +81,25 @@ GEM guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) htmlbeautifier (1.1.1) - i18n (0.7.0) - json (1.8.3) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + json (1.8.6) listen (3.0.6) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9.7) - loofah (2.0.3) + loofah (2.2.3) + crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.0.10) - mail (2.6.5) - mime-types (>= 1.16, < 4) + mail (2.7.1) + mini_mime (>= 0.1.1) method_source (0.8.2) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_portile2 (2.0.0) - minitest (5.8.4) + mini_mime (1.0.1) + mini_portile2 (2.4.0) + minitest (5.11.3) nenv (0.3.0) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) + nokogiri (1.10.1) + mini_portile2 (~> 2.4.0) notiffany (0.0.8) nenv (~> 0.1) shellany (~> 0.0) @@ -106,7 +107,7 @@ GEM coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - rack (1.6.4) + rack (1.6.11) rack-test (0.6.3) rack (>= 1.0) rails (4.2.6) @@ -122,12 +123,12 @@ GEM sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) + rails-dom-testing (1.0.9) + activesupport (>= 4.2.0, < 5.0) + nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) railties (4.2.6) actionpack (= 4.2.6) activesupport (= 4.2.6) @@ -161,7 +162,11 @@ GEM rspec-mocks (~> 3.2.0) rspec-support (~> 3.2.0) rspec-support (3.2.2) - sass (3.4.23) + sass (3.7.3) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) shellany (0.0.1) simplecov (0.12.0) docile (~> 1.1.0) @@ -169,17 +174,17 @@ GEM simplecov-html (~> 0.10.0) simplecov-html (0.10.0) slop (3.6.0) - sprockets (3.7.1) + sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.0) + sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.11) thor (0.19.1) - thread_safe (0.3.5) - tzinfo (1.2.2) + thread_safe (0.3.6) + tzinfo (1.2.5) thread_safe (~> 0.1) PLATFORMS diff --git a/app/helpers/govuk_elements_errors_helper.rb b/app/helpers/govuk_elements_errors_helper.rb index a7c022b..e82cf70 100644 --- a/app/helpers/govuk_elements_errors_helper.rb +++ b/app/helpers/govuk_elements_errors_helper.rb @@ -88,7 +88,7 @@ def self.children_with_errors object def self.error_summary_div &block content_tag(:div, class: 'error-summary', - role: 'group', + role: 'alert', aria: { labelledby: 'error-summary-heading' }, @@ -98,7 +98,7 @@ def self.error_summary_div &block end def self.error_summary_heading text - content_tag :h1, + content_tag :h2, text, id: 'error-summary-heading', class: 'heading-medium error-summary-heading' diff --git a/lib/govuk_elements_form_builder/components/error_summary.rb b/lib/govuk_elements_form_builder/components/error_summary.rb deleted file mode 100644 index e69de29..0000000 diff --git a/spec/helpers/govuk_elements_errors_helper_spec.rb b/spec/helpers/govuk_elements_errors_helper_spec.rb index e4db2e3..65fcceb 100644 --- a/spec/helpers/govuk_elements_errors_helper_spec.rb +++ b/spec/helpers/govuk_elements_errors_helper_spec.rb @@ -51,9 +51,19 @@ expect(output).to_not be_nil end + it 'expects the `div.error-summary` to have specific attributes' do + expect( + pretty_output + ).to have_tag('div.error-summary', with: { + role: 'alert', + tabindex: '-1', + 'aria-labelledby': 'error-summary-heading', + }) + end + it 'outputs title and description' do expect(pretty_output).to have_tag('div.error-summary') do - with_tag 'h1#error-summary-heading', summary_title + with_tag 'h2#error-summary-heading', summary_title with_tag 'p', summary_description end end @@ -100,7 +110,7 @@ it 'outputs title and description' do expect(pretty_output).to have_tag('div.error-summary') do - with_tag 'h1#error-summary-heading', summary_title + with_tag 'h2#error-summary-heading', summary_title with_tag 'p', summary_description end end @@ -143,7 +153,7 @@ it 'outputs title and description' do expect(pretty_output).to have_tag('div.error-summary') do - with_tag 'h1#error-summary-heading', summary_title + with_tag 'h2#error-summary-heading', summary_title with_tag 'p', summary_description end end diff --git a/spec/lib/govuk_elements_form_builder/form_builder_spec.rb b/spec/lib/govuk_elements_form_builder/form_builder_spec.rb index 2ef8215..5770fba 100644 --- a/spec/lib/govuk_elements_form_builder/form_builder_spec.rb +++ b/spec/lib/govuk_elements_form_builder/form_builder_spec.rb @@ -8,7 +8,7 @@ class TestHelper < ActionView::Base; end include TranslationHelper it "should have a version" do - expect(GovukElementsFormBuilder::VERSION).to eq("1.1.0") + expect(GovukElementsFormBuilder::VERSION).to eq("1.2.0") end let(:helper) { TestHelper.new }