Class: Axe::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/axe/core.rb

Constant Summary collapse

JS_NAME =
"axe"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ Core

Returns a new instance of Core.



12
13
14
15
# File 'lib/axe/core.rb', line 12

def initialize(page)
  @page = wrap_driver page
  load_axe_core Axe::Configuration.instance.jslib
end

Class Method Details

.has_run_partial?(page) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
32
33
# File 'lib/axe/core.rb', line 29

def self.has_run_partial?(page)
  page.evaluate_script <<-JS
      typeof window.axe.runPartial === 'function'
  JS
end

Instance Method Details

#call(callable) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/axe/core.rb', line 17

def call(callable)
  if use_run_partial
    callable.analyze_post_43x @page, self
  else
    callable.call @page
  end
end

#call_verbatim(callable) ⇒ Object



25
26
27
# File 'lib/axe/core.rb', line 25

def call_verbatim(callable)
  callable.call @page
end