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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d67be87ff09004b548efe9110eac55222af1f3cebe85f03e0d656bf36c08dcef
4
- data.tar.gz: bbe70df3385ea8b4f694a211a58b58fec8ed966a8abd5ad3e980c67b8d91b7c2
3
+ metadata.gz: df98bc53d824ac1d343ffa5bccc2e2502f7159a5ee0d08c943224b609136f17a
4
+ data.tar.gz: 60a7fd21246109d0a64eb43da176766771ddda8f0259cf181b5051351bbdae32
5
5
  SHA512:
6
- metadata.gz: 9d3eeddd20dc1af59906f899e39c94ae2c0013d424ab4c04166b7cc7b03fec479b8a93ce8d49d536ad4caf426f52b43de0424e3362727911eae104f423a98d01
7
- data.tar.gz: 9b848d5ebeb2211bdabe89939d0acb545ee7e214151fbbaf361dd42f3f94ec0b2b07518bb58b9e86c3016d35ce778dadcdaad0e42be7c86986c198e4fed46454
6
+ metadata.gz: a602649f4fd0e33e0349b36463d207bf7b017e284b56355c1363d6958a7f5c1d721013d31394b9070ddeda1cb2812b9d86527f574a6dab16f273938fe25aa22b
7
+ data.tar.gz: 001e707a196745cd588a426b15babaf57c3d122f583f94dfd40156fde6c080915addbef51f31c6f9ddb0b60e80b34a35d1db20e1f547a4ec9109447f31acbb5a
@@ -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
@@ -1,7 +1,6 @@
1
1
  module Axe
2
2
  module API
3
3
  class Audit
4
-
5
4
  attr_reader :invocation, :results
6
5
 
7
6
  def initialize(invocation, results)
@@ -27,7 +27,6 @@ module Axe
27
27
  end
28
28
 
29
29
  alias :to_s :to_json
30
-
31
30
  end
32
31
  end
33
32
  end
@@ -5,7 +5,6 @@ module Axe
5
5
  module API
6
6
  class Results
7
7
  class Check < ValueObject
8
-
9
8
  values do
10
9
  attribute :data, ::String
11
10
  attribute :id, ::Symbol
@@ -27,7 +26,6 @@ module Axe
27
26
  relatedNodes: relatedNodes.map(&:to_h)
28
27
  }
29
28
  end
30
-
31
29
  end
32
30
  end
33
31
  end
@@ -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
@@ -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,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
- -> (line) { line.prepend(" " * 4) unless line.nil? }
45
+ ->(line) { line.prepend(" " * 4) unless line.nil? }
47
46
  end
48
47
 
49
48
  def title_message(count)
@@ -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?
@@ -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,32 +13,27 @@ require 'axe/expectation'
13
13
  module Axe
14
14
  module Cucumber
15
15
  class Step
16
- REGEX = /^
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(?<negate> not)? be accessible)
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 "(?<inclusion>.*?)")?
23
-
22
+ REGEX_CAPTURE_INCLUSION = '(?-x:;? within "(.*?)")?'
24
23
  # optionally specify subtrees to be excluded, via CSS selector
25
- (?-x:;?(?: but)? excluding "(?<exclusion>.*?)")?
26
-
24
+ REGEX_CAPTURE_EXCLUSION = '(?-x:;?(?: but)? excluding "(.*?)")?'
27
25
  # optionally specify ruleset via list of comma-separated tags
28
- (?-x:;? according to: (?<tags>.*?))?
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(?<run_only> only)?: (?<run_rules>.*?))?
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: (?<skip_rules>.*?))?
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: (?<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))
@@ -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
@@ -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,8 +25,7 @@ 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
-
31
30
  end
32
31
  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
-
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['#{ 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,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
@@ -2,7 +2,6 @@ require 'dumb_delegator'
2
2
 
3
3
  module WebDriverScriptAdapter
4
4
  class QuerySelectorAdapter < ::DumbDelegator
5
-
6
5
  def self.wrap(driver)
7
6
  # capybara: all(<tag>) but also seems to support all(:css, <tag>)
8
7
  # 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.fca8dd7
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-09 00:00:00.000000000 Z
12
+ date: 2019-07-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dumb_delegator