axe-matchers 2.3.0.pre.4f118a1 → 2.3.0.pre.7d7237e
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 +1 -0
- data/lib/axe/api/options.rb +1 -0
- data/lib/axe/api/results/check.rb +2 -0
- data/lib/axe/api/results/checked_node.rb +3 -2
- data/lib/axe/api/results/node.rb +3 -3
- data/lib/axe/api/results/rule.rb +4 -3
- 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 +17 -12
- data/lib/axe/finds_page.rb +1 -1
- data/lib/axe/hooks.rb +4 -3
- 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 +4 -0
- data/lib/webdriver_script_adapter/query_selector_adapter.rb +1 -0
- 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: 9191aa25aba5de9d1c4fac125c1340edfde50f82b19e421742f10cc70e690cfa
|
4
|
+
data.tar.gz: 2c969f5d749d4fe39589e0dfcbb112896cd69a67d2e14a8dbaeb90984c88e140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bd362dea56eda964442e6c73851279bfbd5876fedf66984e7aa0fb398815f81b0ce7f1e6e61d4721731f80fa75e5e6761448262a21e68ae9e96ffba9fae02c2
|
7
|
+
data.tar.gz: 1b2c934a415079d80b66140ec471d25d6b108d4e3ae2fbea6d836c26d33db1c24fecf92e84ac0503188ba6a96b29a04091963c7a96a8dbd092b744afc1297502
|
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
|
-
[@context, @options]
|
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 + ['callback']).join(', ')
|
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,6 +5,7 @@ module Axe
|
|
5
5
|
module API
|
6
6
|
class Results
|
7
7
|
class CheckedNode < Node
|
8
|
+
|
8
9
|
values do
|
9
10
|
attribute :impact, ::Symbol
|
10
11
|
attribute :any, ::Array[Check]
|
@@ -39,10 +40,10 @@ module Axe
|
|
39
40
|
private
|
40
41
|
|
41
42
|
def fix(checks, message)
|
42
|
-
valid_checks = checks.reject
|
43
|
+
valid_checks = checks.reject{|c| c.nil?}
|
43
44
|
[
|
44
45
|
(message unless valid_checks.empty?),
|
45
|
-
valid_checks.map(&:failure_message).map
|
46
|
+
valid_checks.map(&:failure_message).map{|line| line.prepend("- ") }
|
46
47
|
].compact
|
47
48
|
end
|
48
49
|
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 #
|
9
|
+
attribute :target #String or Array[String]
|
10
10
|
end
|
11
11
|
|
12
12
|
def failure_messages
|
13
|
-
[selector_message, node_html]
|
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*/,
|
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,12 +17,13 @@ module Axe
|
|
17
17
|
|
18
18
|
def failure_messages(index)
|
19
19
|
[
|
20
|
-
title_message(index
|
20
|
+
title_message(index+1),
|
21
21
|
*[
|
22
22
|
helpUrl,
|
23
23
|
node_count_message,
|
24
24
|
"",
|
25
|
-
nodes.reject
|
25
|
+
nodes.reject{|n| n.nil?}.map(&:failure_messages).map{|n| n.push("")}.flatten.map(&indent)
|
26
|
+
|
26
27
|
].flatten.map(&indent)
|
27
28
|
]
|
28
29
|
end
|
@@ -42,7 +43,7 @@ module Axe
|
|
42
43
|
private
|
43
44
|
|
44
45
|
def indent
|
45
|
-
->(line) { line.prepend(" " * 4) unless line.nil? }
|
46
|
+
-> (line) { line.prepend(" " * 4) unless line.nil? }
|
46
47
|
end
|
47
48
|
|
48
49
|
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
|
-
#
|
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
|
-
[@context, @options]
|
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 + ['callback']).join(', ')
|
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 [String(s)]
|
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
|
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,27 +13,32 @@ require 'axe/expectation'
|
|
13
13
|
module Axe
|
14
14
|
module Cucumber
|
15
15
|
class Step
|
16
|
-
|
17
|
-
|
18
|
-
###############
|
16
|
+
REGEX = /^
|
17
|
+
|
19
18
|
# require initial phrasing, with 'not' to negate the matcher
|
20
|
-
|
19
|
+
(?-x:the page should(?<negate> not)? be accessible)
|
20
|
+
|
21
21
|
# optionally specify which subtree to check, via CSS selector
|
22
|
-
|
22
|
+
(?-x:;? within "(?<inclusion>.*?)")?
|
23
|
+
|
23
24
|
# optionally specify subtrees to be excluded, via CSS selector
|
24
|
-
|
25
|
+
(?-x:;?(?: but)? excluding "(?<exclusion>.*?)")?
|
26
|
+
|
25
27
|
# optionally specify ruleset via list of comma-separated tags
|
26
|
-
|
28
|
+
(?-x:;? according to: (?<tags>.*?))?
|
29
|
+
|
27
30
|
# optionally specify rules to check as comma-separated list of rule ids
|
28
31
|
# in addition to default ruleset or explicit ruleset specified above via tags
|
29
32
|
# if the 'only' keyword is supplied, then *only* the listed rules are checked, not *additionally*
|
30
|
-
|
33
|
+
(?-x:;?(?: and)? checking(?<run_only> only)?: (?<run_rules>.*?))?
|
34
|
+
|
31
35
|
# optionally specify rules to skip as comma-separated list of rule ids
|
32
|
-
|
36
|
+
(?-x:;?(?: but)? skipping: (?<skip_rules>.*?))?
|
37
|
+
|
33
38
|
# optionally specify custom options to pass directly to axe-core as a yaml-parsed hash or json string
|
34
|
-
|
39
|
+
(?-x:;? with options: (?<options>.*?))?
|
35
40
|
|
36
|
-
|
41
|
+
$/x
|
37
42
|
|
38
43
|
def self.create_for(world)
|
39
44
|
new(FindsPage.in(world).page)
|
@@ -43,7 +48,7 @@ module Axe
|
|
43
48
|
@page = page
|
44
49
|
end
|
45
50
|
|
46
|
-
def assert_accessibility(negate
|
51
|
+
def assert_accessibility(negate=false, inclusion="", exclusion="", tags="", run_only=false, run_rules="", skip_rules="", options=nil)
|
47
52
|
is_accessible = Axe::Matchers::BeAccessible.new.tap do |a|
|
48
53
|
a.within(*selector(inclusion))
|
49
54
|
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 = [:after_load]
|
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
|
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,7 +25,8 @@ module Axe
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def self.initialize_callbacks_array_per_hook
|
28
|
-
Hash[HOOKS.map
|
28
|
+
Hash[ HOOKS.map{|name| [name, []]} ]
|
29
29
|
end
|
30
|
+
|
30
31
|
end
|
31
32
|
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
|
+
|
8
9
|
def self.wrap(driver)
|
9
10
|
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['#{id.respond_to?(:call) ? id.call : id}']"
|
50
|
+
"window['#{ id.respond_to?(:call) ? id.call : id }']"
|
51
51
|
end
|
52
52
|
|
53
53
|
def callback(resultsIdentifier)
|
@@ -2,6 +2,7 @@ require 'dumb_delegator'
|
|
2
2
|
|
3
3
|
module WebDriverScriptAdapter
|
4
4
|
class FrameAdapter < ::DumbDelegator
|
5
|
+
|
5
6
|
def self.wrap(driver)
|
6
7
|
if driver.respond_to?(:within_frame)
|
7
8
|
CapybaraAdapter.new driver
|
@@ -53,8 +54,10 @@ module WebDriverScriptAdapter
|
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
57
|
+
|
56
58
|
# Selenium Webdriver < 2.43 doesnt support moving back to the parent
|
57
59
|
class ParentlessFrameAdapter < ::DumbDelegator
|
60
|
+
|
58
61
|
# storage of frame stack (for reverting to parent) taken from Capybara
|
59
62
|
# : https://github.com/jnicklas/capybara/blob/2.6.2/lib/capybara/selenium/driver.rb#L117-L147
|
60
63
|
#
|
@@ -76,5 +79,6 @@ module WebDriverScriptAdapter
|
|
76
79
|
def find_frames
|
77
80
|
find_elements(:css, 'iframe')
|
78
81
|
end
|
82
|
+
|
79
83
|
end
|
80
84
|
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.7d7237e
|
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-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dumb_delegator
|