axe-core-api 4.4.1 → 4.4.2.pre.8f3f1ee

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: 07c54fec321a9ccf4b40605542684b4356bf077ccd8b0c67c64e517ae693239b
4
- data.tar.gz: 97f2c2fb19e2f768be90aca6e9082e93f029c00b46e129c1b10692150ea8f976
3
+ metadata.gz: 8e914d31ca3f36fb948f723c8fcc7319dba00ad4feda2f59b8df248ffa128257
4
+ data.tar.gz: f9dbed31cbe416018ae49bd3b06be1e7f66a234ea52cf288e0dfbb4772d61b72
5
5
  SHA512:
6
- metadata.gz: 2606c86f1acfb5921cb211b6259c48beb8496bd3a9a87a7e7f8592f9e9db6d8bd7767451ea25d59e455ed61cec61d000610c14e521a1e01a34e21829be0b1f8f
7
- data.tar.gz: ffda7076705f90c02c35619df3689d8d688781604460bcc6ed371f98b8a9fd0f16df855b6d1eff9ed309d25233e1879e56bef11b0ca43cd8ccc6158eb203dbc6
6
+ metadata.gz: fe375fdcc5c66e53c7cce341fc7125dddcbce59ee502131814689aeaf9cc334387b021ae7cf4f62b1835aff744b0eb4beb3ef342e5b67121e1bae6f10bc29fc4
7
+ data.tar.gz: 6596c0477f43d0a7a1294ed60e78514692a60fb75fb7a45c14f8130d0805eefd283fd45c455391450b25a6a747c1541ebdfec6cff525ad97fde778a12e184ee7
data/lib/axe/core.rb CHANGED
@@ -25,10 +25,16 @@ module Axe
25
25
  callable.call @page
26
26
  end
27
27
 
28
+ def self.has_run_partial?(page)
29
+ page.evaluate_script <<-JS
30
+ typeof window.axe.runPartial === 'function'
31
+ JS
32
+ end
33
+
28
34
  private
29
35
 
30
36
  def use_run_partial
31
- has_run_partial? and not Axe::Configuration.instance.legacy_mode
37
+ Core.has_run_partial?(@page) and not Axe::Configuration.instance.legacy_mode
32
38
  end
33
39
 
34
40
  def load_axe_core(source)
@@ -40,12 +46,6 @@ module Axe
40
46
  loader.call source
41
47
  end
42
48
 
43
- def has_run_partial?
44
- @page.evaluate_script <<-JS
45
- typeof window.axe.runPartial === 'function'
46
- JS
47
- end
48
-
49
49
  def already_loaded?
50
50
  @page.evaluate_script <<-JS
51
51
  window.#{JS_NAME} &&
data/lib/loader.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require_relative "./axe/configuration"
2
+ require_relative "./axe/core"
2
3
  require_relative "./hooks"
3
4
 
4
5
  module Common
@@ -25,8 +26,8 @@ module Common
25
26
  private
26
27
 
27
28
  def set_allowed_origins
28
- allowed_origins = "<unsafe_all_origins>"
29
- allowed_origins = "<same_origin>" if Axe::Configuration.instance.legacy_mode
29
+ allowed_origins = "<same_origin>"
30
+ allowed_origins = "<unsafe_all_origins>" if !Axe::Configuration.instance.legacy_mode && !Axe::Core::has_run_partial?(@page)
30
31
  @page.execute_script "axe.configure({ allowedOrigins: ['#{allowed_origins}'] });"
31
32
  end
32
33