axe-matchers 2.3.0.pre.4f118a1 → 2.3.0.pre.7d7237e

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: c8cc3bb6df2d71eba50d0395f73c7f0566f1e6679d1721662de4ef0e3bbd96e7
4
- data.tar.gz: 90182a1592571ceed0f79cc4de8aebded3f42a510b11956c0cf610c0a0028a6f
3
+ metadata.gz: 9191aa25aba5de9d1c4fac125c1340edfde50f82b19e421742f10cc70e690cfa
4
+ data.tar.gz: 2c969f5d749d4fe39589e0dfcbb112896cd69a67d2e14a8dbaeb90984c88e140
5
5
  SHA512:
6
- metadata.gz: 35fdb410b10d107450b452e5912a0bee980a311e19142bb76b7e9bd0640bcec3725ab3aeae0efcda9c2b82db60f968afcd759c0fe1eae7b4301cbec6067e6ca5
7
- data.tar.gz: 6a862b5fe3dfbf5553615329aa0c4449d5a51c1565c4a0d43b8e1fa0e9019a0980c75c370466ebf6b1bceef151b9d971a172614d985630602a22ca3cd4f4a55e
6
+ metadata.gz: 0bd362dea56eda964442e6c73851279bfbd5876fedf66984e7aa0fb398815f81b0ce7f1e6e61d4721731f80fa75e5e6761448262a21e68ae9e96ffba9fae02c2
7
+ data.tar.gz: 1b2c934a415079d80b66140ec471d25d6b108d4e3ae2fbea6d836c26d33db1c24fecf92e84ac0503188ba6a96b29a04091963c7a96a8dbd092b744afc1297502
@@ -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
@@ -1,6 +1,7 @@
1
1
  module Axe
2
2
  module API
3
3
  class Audit
4
+
4
5
  attr_reader :invocation, :results
5
6
 
6
7
  def initialize(invocation, results)
@@ -27,6 +27,7 @@ module Axe
27
27
  end
28
28
 
29
29
  alias :to_s :to_json
30
+
30
31
  end
31
32
  end
32
33
  end
@@ -5,6 +5,7 @@ module Axe
5
5
  module API
6
6
  class Results
7
7
  class Check < ValueObject
8
+
8
9
  values do
9
10
  attribute :data, ::String
10
11
  attribute :id, ::Symbol
@@ -26,6 +27,7 @@ module Axe
26
27
  relatedNodes: relatedNodes.map(&:to_h)
27
28
  }
28
29
  end
30
+
29
31
  end
30
32
  end
31
33
  end
@@ -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 { |c| c.nil? }
43
+ valid_checks = checks.reject{|c| c.nil?}
43
44
  [
44
45
  (message unless valid_checks.empty?),
45
- valid_checks.map(&:failure_message).map { |line| line.prepend("- ") }
46
+ valid_checks.map(&:failure_message).map{|line| line.prepend("- ") }
46
47
  ].compact
47
48
  end
48
49
  end
@@ -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
- [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*/, '')}" unless html.nil?
30
+ "HTML: #{html.gsub(/^\s*|\n*/,'')}" unless html.nil?
31
31
  end
32
32
  end
33
33
  end
@@ -17,12 +17,13 @@ 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)
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
- # 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
- [@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
@@ -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
@@ -18,9 +18,9 @@ module Axe
18
18
  attr_accessor :page, :jslib_path, :skip_iframes
19
19
 
20
20
  def_delegators ::WebDriverScriptAdapter,
21
- :async_results_identifier, :async_results_identifier=,
22
- :max_wait_time, :max_wait_time=,
23
- :wait_interval, :wait_interval=
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
@@ -13,27 +13,32 @@ require 'axe/expectation'
13
13
  module Axe
14
14
  module Cucumber
15
15
  class Step
16
- ###############
17
- # Extracting regex into variable to allow for easier consumption elsewhere
18
- ###############
16
+ REGEX = /^
17
+
19
18
  # require initial phrasing, with 'not' to negate the matcher
20
- REGEX_CAPTURE_NEGATE = '(?-x:the page should( not)? be accessible)'
19
+ (?-x:the page should(?<negate> not)? be accessible)
20
+
21
21
  # optionally specify which subtree to check, via CSS selector
22
- REGEX_CAPTURE_INCLUSION = '(?-x:;? within "(.*?)")?'
22
+ (?-x:;? within "(?<inclusion>.*?)")?
23
+
23
24
  # optionally specify subtrees to be excluded, via CSS selector
24
- REGEX_CAPTURE_EXCLUSION = '(?-x:;?(?: but)? excluding "(.*?)")?'
25
+ (?-x:;?(?: but)? excluding "(?<exclusion>.*?)")?
26
+
25
27
  # optionally specify ruleset via list of comma-separated tags
26
- REGEX_CAPTURE_TAGS = '(?-x:;? according to: (.*?))?'
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
- REGEX_CAPTURE_RUN_ONLY_RUN_RULES = '(?-x:;?(?: and)? checking( only)?: (.*?))?'
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
- REGEX_CAPTURE_SKIP_RULES = '(?-x:;?(?: but)? skipping: (.*?))?'
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
- REGEX_CAPTURE_OPTIONS = '(?-x:;? with options: (.*?))?'
39
+ (?-x:;? with options: (?<options>.*?))?
35
40
 
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
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 = false, inclusion = "", exclusion = "", tags = "", run_only = false, run_rules = "", skip_rules = "", options = nil)
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))
@@ -2,7 +2,7 @@ require 'axe/configuration'
2
2
 
3
3
  module Axe
4
4
  class FindsPage
5
- WEBDRIVER_NAMES = [:page, :browser, :driver, :webdriver]
5
+ WEBDRIVER_NAMES = [ :page, :browser, :driver, :webdriver ]
6
6
 
7
7
  class << self
8
8
  alias :in :new
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 = 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,7 +25,8 @@ module Axe
25
25
  private
26
26
 
27
27
  def self.initialize_callbacks_array_per_hook
28
- Hash[HOOKS.map { |name| [name, []] }]
28
+ Hash[ HOOKS.map{|name| [name, []]} ]
29
29
  end
30
+
30
31
  end
31
32
  end
@@ -1,4 +1,4 @@
1
- # TODO
1
+ #TODO
2
2
  # - able to be extended
3
3
  # - able to be used without extending (module_function)
4
4
  # - variant that returns nil instead of self
@@ -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
@@ -2,6 +2,7 @@ require 'dumb_delegator'
2
2
 
3
3
  module WebDriverScriptAdapter
4
4
  class QuerySelectorAdapter < ::DumbDelegator
5
+
5
6
  def self.wrap(driver)
6
7
  # capybara: all(<tag>) but also seems to support all(:css, <tag>)
7
8
  # watir: elements(:css); also supports #iframes
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.4f118a1
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-10 00:00:00.000000000 Z
12
+ date: 2019-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dumb_delegator