axe-core-api 4.0.0.pre.5880fc5 → 4.0.0.pre.6784dc7

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: 29571d99cab55e3437ce1845350d9bfb0aab8c916ccc340f893f2ff0652cf8a0
4
- data.tar.gz: cc6fe84356cdd3256270046b34c8015415b4afaaeb23851daaa2ff803dfa791f
3
+ metadata.gz: 3d2fa9b6947cdd9eea1ed241a92efbf8d63d387c6bc605c654e1dda0205229f1
4
+ data.tar.gz: 3b553e7b16eb52711025f298a47e362a2b353ded1cda270de49b39975023e9b6
5
5
  SHA512:
6
- metadata.gz: 7b5cf5569f40a0705e2f6189fc5630b149b7a5e39a55f9bb5d62c78351c07f5a59a1ec6cc04bbef8fd02c05f7a28217a8a67e8666cc81f123140bcde08730984
7
- data.tar.gz: f0b3ecbb1d18a2e62ee52da9864da6c1fbd65158faa7b2801c416c16230dcc36094937bcff6319af4e4450188a643203445b0309f6109d4f87d336e88d53a292
6
+ metadata.gz: e58b998fb631dc8e62f58af21b3528c82b19aa7526e600c2902b4bdddfa6281e3e592edbc5eaf6a22f1e81db1cca0e145a70849a7f02ebcc5b6d583a6d6f2c60
7
+ data.tar.gz: 59f35e9ac3f5982f0db78cc8893416be3b26949ba9337c9980a566edebcb6bcb80f3ced604f96b20bb1086c777e67d4e61506fef351790f46b1b979b36119d2f
@@ -26,7 +26,7 @@ module Axe
26
26
  # init
27
27
  def initialize
28
28
  @page = :page
29
- @skip_iframes = nil
29
+ @skip_iframes = :skip_iframes
30
30
  @jslib_path = get_root + "/node_modules/axe-core/axe.min.js"
31
31
  end
32
32
 
data/lib/axe/core.rb CHANGED
@@ -31,7 +31,6 @@ module Axe
31
31
  end
32
32
 
33
33
  def wrap_driver(driver)
34
- driver = driver.driver if driver.respond_to? :driver
35
34
  ::WebDriverScriptAdapter::QuerySelectorAdapter.wrap(
36
35
  ::WebDriverScriptAdapter::FrameAdapter.wrap(
37
36
  ::WebDriverScriptAdapter::ExecuteAsyncScriptAdapter.wrap(
data/lib/loader.rb CHANGED
@@ -10,7 +10,6 @@ module Common
10
10
 
11
11
  def call(source)
12
12
  @page.execute_script source
13
- @page.execute_script "axe.configure({ allowedOrigins: ['<unsafe_all_origins>'] });"
14
13
  Common::Hooks.run_after_load @lib
15
14
  load_into_iframes(source) unless Axe::Configuration.instance.skip_iframes
16
15
  end
@@ -3,7 +3,7 @@ require "dumb_delegator"
3
3
  module WebDriverScriptAdapter
4
4
  class FrameAdapter < ::DumbDelegator
5
5
  def self.wrap(driver)
6
- if driver.respond_to?(:find_css)
6
+ if driver.respond_to?(:within_frame)
7
7
  CapybaraAdapter.new driver
8
8
  elsif !driver.respond_to?(:switch_to)
9
9
  WatirAdapter.new driver
@@ -16,19 +16,20 @@ module WebDriverScriptAdapter
16
16
 
17
17
  private
18
18
 
19
- class WatirAdapter < ::DumbDelegator
20
- def initialize(driver)
21
- super(driver)
22
- @driver = driver
19
+ class CapybaraAdapter < ::DumbDelegator
20
+ def find_frames
21
+ all(:css, "iframe")
23
22
  end
23
+ end
24
24
 
25
+ class WatirAdapter < ::DumbDelegator
25
26
  # delegate to Watir's Selenium #driver
26
27
  def within_frame(frame, &block)
27
- SeleniumAdapter.instance_method(:within_frame).bind(FrameAdapter.wrap @driver).call(frame, &block)
28
+ SeleniumAdapter.instance_method(:within_frame).bind(FrameAdapter.wrap driver).call(frame, &block)
28
29
  end
29
30
 
30
31
  def find_frames
31
- find_elements(:css, "iframe")
32
+ driver.find_elements(:css, "iframe")
32
33
  end
33
34
  end
34
35
 
@@ -56,41 +57,6 @@ module WebDriverScriptAdapter
56
57
  end
57
58
  end
58
59
 
59
- class CapybaraAdapter < ::DumbDelegator
60
- def initialize(driver)
61
- super(driver)
62
- @driver = driver
63
- end
64
-
65
- def within_frame(frame)
66
- # Patch the `Symbol` class to respond to the :native method.
67
- # Will be fixed in https://github.com/teamcapybara/capybara/pull/2462
68
- (:parent).class.define_method(:native) do
69
- nil
70
- end
71
- switch_to_frame frame
72
- yield
73
- ensure
74
- begin
75
- switch_to_frame :parent
76
- rescue => e
77
- if /switchToParentFrame|frame\/parent/.match(e.message)
78
- ::Kernel.warn "WARNING:
79
- This browser only supports first-level iframes.
80
- Second-level iframes and beyond will not be audited.
81
- To skip auditing all iframes,
82
- set Axe::Configuration#skip_iframes=true"
83
- end
84
- switch_to_frame :top
85
- end
86
- end
87
-
88
- def find_frames
89
- find_css("iframe")
90
- end
91
- end
92
-
93
-
94
60
  # Selenium Webdriver < 2.43 doesnt support moving back to the parent
95
61
  class ParentlessFrameAdapter < ::DumbDelegator
96
62
  # storage of frame stack (for reverting to parent) taken from Capybara