capybara_accessibility_audit 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9d57dbd535b2d7c257f1dd19975788449178add55e5368aa3dec36ca7239612
4
- data.tar.gz: 0a5b06b7b534d613052590db1242ef6c1d28db0820fcea718588c297aebcbc0b
3
+ metadata.gz: 6f3c291518b387bd0ebb540dd63aa42e7ff1740741ca5dbf1a25cc4be69cbcfc
4
+ data.tar.gz: bf7184f0a2ac3b7014665cb58bb9bed8d5d8ef180974b78e4d852d2759cec221
5
5
  SHA512:
6
- metadata.gz: 6d143c9f23767f861bc58481e0bd2513285de60b8fae286153c269ff52c36da9cf2aeca9a834d15e629bcd12b8dd49d364aadd6a25b5fcebdc861e42090ca395
7
- data.tar.gz: 423c722319bcc0118f8ee87ca4927626a24f3a327f92469b8f8f1fb4540c4a871213bba05fd439d234fe49553057a3317094c8139ed8ebdfccb332bcba7f2563
6
+ metadata.gz: 7f6975cda1ae0f1465159dc662a171b1236eda9d8e3afaa605ce4dee7ee49cb29ed806f40b01c4394a9c37257ae689c825669371fc943aa3142d272f53c95eb2
7
+ data.tar.gz: 40cff319bee4767c4e1e12d37b074728d24d84dc9ab302ec481104a22c87f30dad4c851ee96aaecf170188d821d27a09e793dba4455a6495f45c1afe6416b200
data/README.md CHANGED
@@ -1,9 +1,7 @@
1
1
  # CapybaraAccessibilityAudit
2
2
 
3
- :warning: This is pre-release software. :warning:
4
-
5
3
  Extend your Capybara-powered System Tests to automatically audit the page for
6
- WCAG Stardards-based accessibility violations.
4
+ [WCAG Standards-based accessibility violations](https://www.w3.org/WAI/standards-guidelines/wcag/).
7
5
 
8
6
  ## Usage
9
7
 
@@ -64,7 +62,7 @@ end
64
62
 
65
63
  ## Frequently Asked Questions
66
64
 
67
- My application already exists, will automated accessibility audits are uncovering violations left and right. Do I have to fix them all at once?
65
+ My application already exists, automated accessibility audits are uncovering violations left and right. Do I have to fix them all at once?
68
66
  ---
69
67
 
70
68
  Your suite has control over which rules are skipped and which rules are
@@ -210,9 +208,7 @@ end
210
208
  Add this line to your application's Gemfile:
211
209
 
212
210
  ```ruby
213
- gem "capybara_accessibility_audit",
214
- github: "thoughtbot/capybara_accessibility_audit",
215
- branch: "main"
211
+ gem "capybara_accessibility_audit"
216
212
  ```
217
213
 
218
214
  And then execute:
@@ -226,3 +222,21 @@ Please read [CONTRIBUTING.md](./CONTRIBUTING.md).
226
222
 
227
223
  ## License
228
224
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
225
+
226
+ <!-- START /templates/footer.md -->
227
+ ## About thoughtbot
228
+
229
+ ![thoughtbot](https://thoughtbot.com/thoughtbot-logo-for-readmes.svg)
230
+
231
+ This repo is maintained and funded by thoughtbot, inc.
232
+ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
233
+
234
+ We love open source software!
235
+ See [our other projects][community].
236
+ We are [available for hire][hire].
237
+
238
+ [community]: https://thoughtbot.com/community?utm_source=github
239
+ [hire]: https://thoughtbot.com/hire-us?utm_source=github
240
+
241
+
242
+ <!-- END /templates/footer.md -->
@@ -1,14 +1,27 @@
1
- require "axe-capybara"
2
1
  require "axe/matchers/be_axe_clean"
3
2
 
4
3
  module CapybaraAccessibilityAudit
5
4
  module AuditSystemTestExtensions
6
5
  extend ActiveSupport::Concern
7
6
 
7
+ MODAL_METHODS =
8
+ if defined?(Capybara::Session::MODAL_METHODS)
9
+ Capybara::Session::MODAL_METHODS
10
+ else
11
+ %i[accept_alert accept_confirm accept_prompt dismiss_confirm dismiss_prompt]
12
+ end
13
+
8
14
  included do
9
15
  class_attribute :accessibility_audit_after_methods, default: Set.new
10
16
  class_attribute :accessibility_audit_enabled, default: true
11
17
  class_attribute :accessibility_audit_options, default: ActiveSupport::OrderedOptions.new
18
+
19
+ MODAL_METHODS.each do |method|
20
+ define_method method do |*arguments, **options, &block|
21
+ result = super(*arguments, **options) { skip_accessibility_audits(&block) }
22
+ result.tap { Auditor.new(self).audit!(method) }
23
+ end
24
+ end
12
25
  end
13
26
 
14
27
  class_methods do
@@ -10,27 +10,33 @@ module CapybaraAccessibilityAudit
10
10
  ]
11
11
  config.capybara_accessibility_audit.audit_enabled = true
12
12
 
13
- ActiveSupport.on_load :action_dispatch_system_test_case do
14
- include CapybaraAccessibilityAudit::AuditSystemTestExtensions
13
+ initializer "capybara_accessibility_audit.minitest" do |app|
14
+ ActiveSupport.on_load :action_dispatch_system_test_case do
15
+ include CapybaraAccessibilityAudit::AuditSystemTestExtensions
15
16
 
16
- self.accessibility_audit_enabled = Rails.configuration.capybara_accessibility_audit.audit_enabled
17
+ self.accessibility_audit_enabled = app.config.capybara_accessibility_audit.audit_enabled
17
18
 
18
- accessibility_audit_after Rails.configuration.capybara_accessibility_audit.audit_after
19
+ accessibility_audit_after app.config.capybara_accessibility_audit.audit_after
20
+ end
19
21
  end
20
22
 
21
- if defined?(RSpec)
22
- RSpec.configure do |config|
23
- config.include CapybaraAccessibilityAudit::AuditSystemTestExtensions, type: :system
24
- config.include CapybaraAccessibilityAudit::AuditSystemTestExtensions, type: :feature
23
+ initializer "capybara_accessibility_audit.rspec" do |app|
24
+ if defined?(RSpec)
25
+ require "rspec/core"
25
26
 
26
- configure = proc do
27
- self.accessibility_audit_enabled = Rails.configuration.capybara_accessibility_audit.audit_enabled
27
+ RSpec.configure do |config|
28
+ config.include CapybaraAccessibilityAudit::AuditSystemTestExtensions, type: :system
29
+ config.include CapybaraAccessibilityAudit::AuditSystemTestExtensions, type: :feature
28
30
 
29
- accessibility_audit_after Rails.configuration.capybara_accessibility_audit.audit_after
30
- end
31
+ configure = proc do
32
+ self.accessibility_audit_enabled = app.config.capybara_accessibility_audit.audit_enabled
31
33
 
32
- config.before(type: :system, &configure)
33
- config.before(type: :feature, &configure)
34
+ accessibility_audit_after app.config.capybara_accessibility_audit.audit_after
35
+ end
36
+
37
+ config.before(type: :system, &configure)
38
+ config.before(type: :feature, &configure)
39
+ end
34
40
  end
35
41
  end
36
42
  end
@@ -1,3 +1,3 @@
1
1
  module CapybaraAccessibilityAudit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara_accessibility_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Doyle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-29 00:00:00.000000000 Z
11
+ date: 2024-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: capybara
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: axe-core-capybara
42
+ name: axe-core-api
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -97,14 +97,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - ">="
99
99
  - !ruby/object:Gem::Version
100
- version: '0'
100
+ version: '3.0'
101
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  requirements: []
107
- rubygems_version: 3.3.3
107
+ rubygems_version: 3.4.1
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Accessibility tooling for Capybara