axe-matchers 2.3.0.pre.fca8dd7 → 2.3.0.pre.7204257
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/axe/api/a11y_check.rb +2 -2
- data/lib/axe/api/audit.rb +0 -1
- data/lib/axe/api/options.rb +0 -1
- data/lib/axe/api/results/check.rb +0 -2
- data/lib/axe/api/results/checked_node.rb +2 -3
- data/lib/axe/api/results/node.rb +3 -3
- data/lib/axe/api/results/rule.rb +3 -4
- data/lib/axe/api/rules.rb +1 -1
- data/lib/axe/api/run.rb +2 -2
- data/lib/axe/api/selector.rb +1 -1
- data/lib/axe/configuration.rb +4 -4
- data/lib/axe/cucumber/step.rb +12 -17
- data/lib/axe/finds_page.rb +1 -1
- data/lib/axe/hooks.rb +3 -4
- data/lib/chain_mail/chainable.rb +1 -1
- data/lib/webdriver_script_adapter/exec_eval_script_adapter.rb +1 -1
- data/lib/webdriver_script_adapter/execute_async_script_adapter.rb +1 -1
- data/lib/webdriver_script_adapter/frame_adapter.rb +0 -4
- data/lib/webdriver_script_adapter/query_selector_adapter.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df98bc53d824ac1d343ffa5bccc2e2502f7159a5ee0d08c943224b609136f17a
|
4
|
+
data.tar.gz: 60a7fd21246109d0a64eb43da176766771ddda8f0259cf181b5051351bbdae32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a602649f4fd0e33e0349b36463d207bf7b017e284b56355c1363d6958a7f5c1d721013d31394b9070ddeda1cb2812b9d86527f574a6dab16f273938fe25aa22b
|
7
|
+
data.tar.gz: 001e707a196745cd588a426b15babaf57c3d122f583f94dfd40156fde6c080915addbef51f31c6f9ddb0b60e80b34a35d1db20e1f547a4ec9109447f31acbb5a
|
data/lib/axe/api/a11y_check.rb
CHANGED
@@ -45,13 +45,13 @@ module Axe
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def js_args
|
48
|
-
[
|
48
|
+
[@context, @options]
|
49
49
|
.reject(&:empty?)
|
50
50
|
.map(&:to_json)
|
51
51
|
end
|
52
52
|
|
53
53
|
def to_js
|
54
|
-
str_args = (js_args + [
|
54
|
+
str_args = (js_args + ['callback']).join(', ')
|
55
55
|
"#{METHOD_NAME}(#{str_args});"
|
56
56
|
end
|
57
57
|
end
|
data/lib/axe/api/audit.rb
CHANGED
data/lib/axe/api/options.rb
CHANGED
@@ -5,7 +5,6 @@ module Axe
|
|
5
5
|
module API
|
6
6
|
class Results
|
7
7
|
class CheckedNode < Node
|
8
|
-
|
9
8
|
values do
|
10
9
|
attribute :impact, ::Symbol
|
11
10
|
attribute :any, ::Array[Check]
|
@@ -40,10 +39,10 @@ module Axe
|
|
40
39
|
private
|
41
40
|
|
42
41
|
def fix(checks, message)
|
43
|
-
valid_checks = checks.reject{|c| c.nil?}
|
42
|
+
valid_checks = checks.reject { |c| c.nil? }
|
44
43
|
[
|
45
44
|
(message unless valid_checks.empty?),
|
46
|
-
valid_checks.map(&:failure_message).map{|line| line.prepend("- ") }
|
45
|
+
valid_checks.map(&:failure_message).map { |line| line.prepend("- ") }
|
47
46
|
].compact
|
48
47
|
end
|
49
48
|
end
|
data/lib/axe/api/results/node.rb
CHANGED
@@ -6,11 +6,11 @@ module Axe
|
|
6
6
|
class Node < ValueObject
|
7
7
|
values do
|
8
8
|
attribute :html, ::String
|
9
|
-
attribute :target #String or Array[String]
|
9
|
+
attribute :target # String or Array[String]
|
10
10
|
end
|
11
11
|
|
12
12
|
def failure_messages
|
13
|
-
[
|
13
|
+
[selector_message, node_html]
|
14
14
|
end
|
15
15
|
|
16
16
|
def to_h
|
@@ -27,7 +27,7 @@ module Axe
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def node_html
|
30
|
-
"HTML: #{html.gsub(/^\s*|\n*/,'')}" unless html.nil?
|
30
|
+
"HTML: #{html.gsub(/^\s*|\n*/, '')}" unless html.nil?
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
data/lib/axe/api/results/rule.rb
CHANGED
@@ -17,13 +17,12 @@ module Axe
|
|
17
17
|
|
18
18
|
def failure_messages(index)
|
19
19
|
[
|
20
|
-
title_message(index+1),
|
20
|
+
title_message(index + 1),
|
21
21
|
*[
|
22
22
|
helpUrl,
|
23
23
|
node_count_message,
|
24
24
|
"",
|
25
|
-
nodes.reject{|n| n.nil?}.map(&:failure_messages).map{|n| n.push("")}.flatten.map(&indent)
|
26
|
-
|
25
|
+
nodes.reject { |n| n.nil? }.map(&:failure_messages).map { |n| n.push("") }.flatten.map(&indent)
|
27
26
|
].flatten.map(&indent)
|
28
27
|
]
|
29
28
|
end
|
@@ -43,7 +42,7 @@ module Axe
|
|
43
42
|
private
|
44
43
|
|
45
44
|
def indent
|
46
|
-
->
|
45
|
+
->(line) { line.prepend(" " * 4) unless line.nil? }
|
47
46
|
end
|
48
47
|
|
49
48
|
def title_message(count)
|
data/lib/axe/api/rules.rb
CHANGED
@@ -26,7 +26,7 @@ module Axe
|
|
26
26
|
|
27
27
|
def to_hash
|
28
28
|
{}.tap do |options|
|
29
|
-
#TODO warn that tags + exclusive-rules are incompatible
|
29
|
+
# TODO warn that tags + exclusive-rules are incompatible
|
30
30
|
options.merge! runOnly: { type: :tag, values: @tags } unless @tags.empty?
|
31
31
|
options.merge! runOnly: { type: :rule, values: @exclusive } unless @exclusive.empty?
|
32
32
|
options.merge! rules: Hash[@included.product([enabled: true]) + @excluded.product([enabled: false])] unless @included.empty? && @excluded.empty?
|
data/lib/axe/api/run.rb
CHANGED
@@ -41,13 +41,13 @@ module Axe
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def js_args
|
44
|
-
[
|
44
|
+
[@context, @options]
|
45
45
|
.reject(&:empty?)
|
46
46
|
.map(&:to_json)
|
47
47
|
end
|
48
48
|
|
49
49
|
def to_js
|
50
|
-
str_args = (js_args + [
|
50
|
+
str_args = (js_args + ['callback']).join(', ')
|
51
51
|
"#{METHOD_NAME}(#{str_args});"
|
52
52
|
end
|
53
53
|
end
|
data/lib/axe/api/selector.rb
CHANGED
@@ -4,7 +4,7 @@ module Axe
|
|
4
4
|
def initialize(s)
|
5
5
|
@selector = case s
|
6
6
|
when Array then s
|
7
|
-
when String, Symbol then [
|
7
|
+
when String, Symbol then [String(s)]
|
8
8
|
when Hash then Selector.new(s[:selector]).to_a.unshift s[:iframe]
|
9
9
|
else Selector.new(s.selector).to_a.unshift s.iframe
|
10
10
|
end
|
data/lib/axe/configuration.rb
CHANGED
@@ -18,9 +18,9 @@ module Axe
|
|
18
18
|
attr_accessor :page, :jslib_path, :skip_iframes
|
19
19
|
|
20
20
|
def_delegators ::WebDriverScriptAdapter,
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
:async_results_identifier, :async_results_identifier=,
|
22
|
+
:max_wait_time, :max_wait_time=,
|
23
|
+
:wait_interval, :wait_interval=
|
24
24
|
|
25
25
|
def initialize
|
26
26
|
@page = :page
|
@@ -32,7 +32,7 @@ module Axe
|
|
32
32
|
end
|
33
33
|
|
34
34
|
class << self
|
35
|
-
def from_yaml(path="config/axe.yml")
|
35
|
+
def from_yaml(path = "config/axe.yml")
|
36
36
|
file = Pathname.new(path)
|
37
37
|
from_hash(YAML.load_file(file)) if file.exist?
|
38
38
|
instance
|
data/lib/axe/cucumber/step.rb
CHANGED
@@ -13,32 +13,27 @@ require 'axe/expectation'
|
|
13
13
|
module Axe
|
14
14
|
module Cucumber
|
15
15
|
class Step
|
16
|
-
|
17
|
-
|
16
|
+
###############
|
17
|
+
# Extracting regex into variable to allow for easier consumption elsewhere
|
18
|
+
###############
|
18
19
|
# require initial phrasing, with 'not' to negate the matcher
|
19
|
-
(?-x:the page should(
|
20
|
-
|
20
|
+
REGEX_CAPTURE_NEGATE = '(?-x:the page should( not)? be accessible)'
|
21
21
|
# optionally specify which subtree to check, via CSS selector
|
22
|
-
(?-x:;? within "(
|
23
|
-
|
22
|
+
REGEX_CAPTURE_INCLUSION = '(?-x:;? within "(.*?)")?'
|
24
23
|
# optionally specify subtrees to be excluded, via CSS selector
|
25
|
-
(?-x:;?(?: but)? excluding "(
|
26
|
-
|
24
|
+
REGEX_CAPTURE_EXCLUSION = '(?-x:;?(?: but)? excluding "(.*?)")?'
|
27
25
|
# optionally specify ruleset via list of comma-separated tags
|
28
|
-
(?-x:;? according to: (
|
29
|
-
|
26
|
+
REGEX_CAPTURE_TAGS = '(?-x:;? according to: (.*?))?'
|
30
27
|
# optionally specify rules to check as comma-separated list of rule ids
|
31
28
|
# in addition to default ruleset or explicit ruleset specified above via tags
|
32
29
|
# if the 'only' keyword is supplied, then *only* the listed rules are checked, not *additionally*
|
33
|
-
(?-x:;?(?: and)? checking(
|
34
|
-
|
30
|
+
REGEX_CAPTURE_RUN_ONLY_RUN_RULES = '(?-x:;?(?: and)? checking( only)?: (.*?))?'
|
35
31
|
# optionally specify rules to skip as comma-separated list of rule ids
|
36
|
-
(?-x:;?(?: but)? skipping: (
|
37
|
-
|
32
|
+
REGEX_CAPTURE_SKIP_RULES = '(?-x:;?(?: but)? skipping: (.*?))?'
|
38
33
|
# optionally specify custom options to pass directly to axe-core as a yaml-parsed hash or json string
|
39
|
-
(?-x:;? with options: (
|
34
|
+
REGEX_CAPTURE_OPTIONS = '(?-x:;? with options: (.*?))?'
|
40
35
|
|
41
|
-
$/x
|
36
|
+
REGEX = /^#{REGEX_CAPTURE_NEGATE}#{REGEX_CAPTURE_INCLUSION}#{REGEX_CAPTURE_EXCLUSION}#{REGEX_CAPTURE_TAGS}#{REGEX_CAPTURE_RUN_ONLY_RUN_RULES}#{REGEX_CAPTURE_SKIP_RULES}#{REGEX_CAPTURE_OPTIONS}$/x
|
42
37
|
|
43
38
|
def self.create_for(world)
|
44
39
|
new(FindsPage.in(world).page)
|
@@ -48,7 +43,7 @@ module Axe
|
|
48
43
|
@page = page
|
49
44
|
end
|
50
45
|
|
51
|
-
def assert_accessibility(negate=false, inclusion="", exclusion="", tags="", run_only=false, run_rules="", skip_rules="", options=nil)
|
46
|
+
def assert_accessibility(negate = false, inclusion = "", exclusion = "", tags = "", run_only = false, run_rules = "", skip_rules = "", options = nil)
|
52
47
|
is_accessible = Axe::Matchers::BeAccessible.new.tap do |a|
|
53
48
|
a.within(*selector(inclusion))
|
54
49
|
a.excluding(*selector(exclusion))
|
data/lib/axe/finds_page.rb
CHANGED
data/lib/axe/hooks.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Axe
|
2
2
|
module Hooks
|
3
|
-
HOOKS = [
|
3
|
+
HOOKS = [:after_load]
|
4
4
|
|
5
5
|
HOOKS.each do |hook_name|
|
6
6
|
# define instance-level registration method per hook
|
7
|
-
define_method hook_name do |callable=nil, &block|
|
7
|
+
define_method hook_name do |callable = nil, &block|
|
8
8
|
callable ||= block
|
9
9
|
Hooks.callbacks.fetch(hook_name) << callable if callable
|
10
10
|
end
|
@@ -25,8 +25,7 @@ module Axe
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def self.initialize_callbacks_array_per_hook
|
28
|
-
Hash[
|
28
|
+
Hash[HOOKS.map { |name| [name, []] }]
|
29
29
|
end
|
30
|
-
|
31
30
|
end
|
32
31
|
end
|
data/lib/chain_mail/chainable.rb
CHANGED
@@ -5,9 +5,9 @@ module WebDriverScriptAdapter
|
|
5
5
|
# (eval is a query, exec is a command)
|
6
6
|
# this decorator makes webdriver act like capybara
|
7
7
|
class ExecEvalScriptAdapter < ::DumbDelegator
|
8
|
-
|
9
8
|
def self.wrap(driver)
|
10
9
|
raise WebDriverError, "WebDriver must respond to #execute_script" unless driver.respond_to? :execute_script
|
10
|
+
|
11
11
|
driver.respond_to?(:evaluate_script) ? driver : new(driver)
|
12
12
|
end
|
13
13
|
|
@@ -47,7 +47,7 @@ module WebDriverScriptAdapter
|
|
47
47
|
|
48
48
|
def async_results_identifier
|
49
49
|
id = WebDriverScriptAdapter.async_results_identifier
|
50
|
-
"window['#{
|
50
|
+
"window['#{id.respond_to?(:call) ? id.call : id}']"
|
51
51
|
end
|
52
52
|
|
53
53
|
def callback(resultsIdentifier)
|
@@ -2,7 +2,6 @@ require 'dumb_delegator'
|
|
2
2
|
|
3
3
|
module WebDriverScriptAdapter
|
4
4
|
class FrameAdapter < ::DumbDelegator
|
5
|
-
|
6
5
|
def self.wrap(driver)
|
7
6
|
if driver.respond_to?(:within_frame)
|
8
7
|
CapybaraAdapter.new driver
|
@@ -54,10 +53,8 @@ module WebDriverScriptAdapter
|
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
|
-
|
58
56
|
# Selenium Webdriver < 2.43 doesnt support moving back to the parent
|
59
57
|
class ParentlessFrameAdapter < ::DumbDelegator
|
60
|
-
|
61
58
|
# storage of frame stack (for reverting to parent) taken from Capybara
|
62
59
|
# : https://github.com/jnicklas/capybara/blob/2.6.2/lib/capybara/selenium/driver.rb#L117-L147
|
63
60
|
#
|
@@ -79,6 +76,5 @@ module WebDriverScriptAdapter
|
|
79
76
|
def find_frames
|
80
77
|
find_elements(:css, 'iframe')
|
81
78
|
end
|
82
|
-
|
83
79
|
end
|
84
80
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: axe-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.0.pre.
|
4
|
+
version: 2.3.0.pre.7204257
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deque Systems
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-07-
|
12
|
+
date: 2019-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dumb_delegator
|