class Axe::API::A11yCheck

Constants

JS_NAME
METHOD_NAME

Public Class Methods

new() click to toggle source
# File lib/axe/api/a11y_check.rb, line 26
def initialize
  @context = Context.new
  @options = Options.new
end

Public Instance Methods

call(page) click to toggle source
# File lib/axe/api/a11y_check.rb, line 31
def call(page)
  audit page do |results|
    Audit.new to_js, Results.new(results)
  end
end

Private Instance Methods

audit(page) { |execute_async_script "#{METHOD_NAME}.apply(#{JS_NAME}, arguments)", *js_args| ... } click to toggle source
# File lib/axe/api/a11y_check.rb, line 43
def audit(page)
  yield page.execute_async_script "#{METHOD_NAME}.apply(#{Core::JS_NAME}, arguments)", *js_args
end
js_args() click to toggle source
# File lib/axe/api/a11y_check.rb, line 47
def js_args
  [@context, @options]
    .reject(&:empty?)
    .map(&:to_json)
end
to_js() click to toggle source
# File lib/axe/api/a11y_check.rb, line 53
def to_js
  str_args = (js_args + ['callback']).join(', ')
  "#{METHOD_NAME}(#{str_args});"
end