diff --git a/Gemfile b/Gemfile index e3fbd82e..423283c5 100644 --- a/Gemfile +++ b/Gemfile @@ -22,6 +22,7 @@ group :development do # Display performance information such as SQL time and flame graphs for each request in your browser. # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md gem 'rack-mini-profiler', '~> 2.0' + gem 'axe-core-rspec' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 0bded32e..1bdc2e4a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,6 +77,19 @@ GEM airbrussh (1.5.3) sshkit (>= 1.6.1, != 1.7.0) ast (2.4.2) + axe-core-api (4.10.1) + dumb_delegator + ostruct + virtus + axe-core-rspec (4.10.1) + axe-core-api (= 4.10.1) + dumb_delegator + ostruct + virtus + axiom-types (0.1.1) + descendants_tracker (~> 0.0.4) + ice_nine (~> 0.11.0) + thread_safe (~> 0.3, >= 0.3.1) base64 (0.2.0) bcrypt_pbkdf (1.1.1) benchmark (0.4.0) @@ -117,6 +130,8 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) + coercible (1.0.0) + descendants_tracker (~> 0.0.1) concurrent-ruby (1.3.4) config (5.5.2) deep_merge (~> 1.2, >= 1.2.1) @@ -130,6 +145,8 @@ GEM irb (~> 1.10) reline (>= 0.3.8) deep_merge (1.2.2) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) diff-lcs (1.5.1) dlss-capistrano (5.2.0) bcrypt_pbkdf @@ -142,6 +159,7 @@ GEM domain_name (0.6.20240107) dotenv (3.1.4) drb (2.2.1) + dumb_delegator (1.0.0) ed25519 (1.3.0) erubi (1.13.0) factory_bot (6.5.0) @@ -183,6 +201,7 @@ GEM http-form_data (2.3.0) i18n (1.14.6) concurrent-ruby (~> 1.0) + ice_nine (0.11.2) importmap-rails (2.0.3) actionpack (>= 6.0.0) activesupport (>= 6.0.0) @@ -374,6 +393,7 @@ GEM railties (>= 6.0.0) stringio (3.1.2) thor (1.3.2) + thread_safe (0.3.6) timeout (0.4.2) tophat (2.3.1) actionpack (>= 3.0.0) @@ -385,6 +405,10 @@ GEM unicode-display_width (2.6.0) uri (1.0.1) useragent (0.16.10) + virtus (2.0.0) + axiom-types (~> 0.1) + coercible (~> 1.0) + descendants_tracker (~> 0.0, >= 0.0.3) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) @@ -403,6 +427,7 @@ PLATFORMS x86_64-linux DEPENDENCIES + axe-core-rspec bootsnap (>= 1.1.0) cancancan capistrano diff --git a/app/views/libraries/_form.html.erb b/app/views/libraries/_form.html.erb index e489c2af..fb23b0f8 100644 --- a/app/views/libraries/_form.html.erb +++ b/app/views/libraries/_form.html.erb @@ -30,7 +30,7 @@ <%= form.label :public, "Display on home page", class: "form-check-label" %> -
Type
<%= f.radio_button :holiday, false, class: "form-check-input"%> - <%= f.label "Quarter or Intersession" %> + <%= f.label :holiday_false, "Quarter or Intersession" %> <%= f.radio_button :holiday, true, class: "form-check-label" %> - <%= f.label "Holiday" %> + <%= f.label :holiday_true, "Holiday" %><%= notice %>
diff --git a/spec/features/axe_spec.rb b/spec/features/axe_spec.rb new file mode 100644 index 00000000..cfbc5e18 --- /dev/null +++ b/spec/features/axe_spec.rb @@ -0,0 +1,106 @@ +# frozen_string_literal: true +require 'rails_helper' +require 'axe-rspec' +RSpec.describe 'Accessibility testing', :js do + # before do + # allow(controller).to receive(:current_user).and_return(user) + # end + let(:library) { create(:location, keeps_hours: true).library } + + before do + stub_current_user(build(:superadmin_user)) + create(:library) + create(:term_hour) + create(:location) + create(:term, dtstart: 1.month.from_now, dtend: 3.months.from_now) + end + + it 'validates the home page' do + visit root_path + expect(page).to be_accessible + end + + it 'validates the individual library page' do + visit library_path(library) + expect(page).to be_accessible + end + + it 'validates the terms page' do + visit terms_path + expect(page).to be_accessible + end + + it 'validates the term page' do + visit term_path(1) + expect(page).to be_accessible + end + + it 'validates the new terms page' do + visit new_term_path + expect(page).to be_accessible + end + + it 'validates the edit terms page' do + visit edit_term_path(1) + expect(page).to be_accessible + end + + it 'validates the spreadsheets page' do + visit spreadsheets_path + expect(page).to be_accessible + end + + it 'validates the new spreadsheets page' do + visit new_spreadsheet_path + expect(page).to be_accessible + end + + it 'validates the new spreadsheets page' do + visit new_spreadsheet_path + expect(page).to be_accessible + end + + it 'validates the spreadsheet libraries page' do + visit spreadsheet_libraries_path + expect(page).to be_accessible + end + + it 'validates the term hours page' do + visit library_term_hours_path(1) + expect(page).to be_accessible + end + + it 'validates the spreadsheet libraries page' do + visit library_term_hours_path(1) + expect(page).to be_accessible + end + + it 'validates the library term hours page' do + visit library_term_hours_path(1) + expect(page).to be_accessible + end + + it 'validates the library term hours page' do + visit new_library_location_path(1) + expect(page).to be_accessible + end + + it 'validates the libraries page' do + visit new_library_path + expect(page).to be_accessible + end + + it 'validates the edit libraries page' do + visit edit_library_path(1) + expect(page).to be_accessible + end + + it 'feedback form' do + visit feedback_path + expect(page).to be_accessible + end + + def be_accessible + be_axe_clean + end +end \ No newline at end of file