Sha256: 5cda46c3ef759253c415ae71f3330d865c410579de071231dfc381114c3a246f

Contents?: true

Size: 1.77 KB

Versions: 1

Compression:

Stored size: 1.77 KB

Contents

require 'capybara'
require 'capybara/accessible/auditor'
require 'capybara/accessible/extensions/element'
require 'capybara/accessible/extensions/driver'
require 'capybara/accessible/version'
require 'capybara/accessible/railtie' if defined?(Rails)

module Capybara
  module Accessible
    class << self
      def skip_audit
        Capybara::Accessible::Auditor.disable
        yield
      ensure
        Capybara::Accessible::Auditor.enable
      end

      def create_driver(base_driver, driver_adaptor, app, **options)
        driver_class = Capybara::Accessible::Extensions::Driver.wrap(base_driver)
        driver = driver_class.new(app, **options)
        driver.accessible = driver_adaptor.new
        driver
      end
    end
  end
end

Capybara.register_driver :accessible do |app|
  puts "DEPRECATED: Please register this driver as 'accessible_selenium'"
  require 'capybara/accessible/adapters/selenium'
  Capybara::Accessible.create_driver(
    Capybara::Selenium::Driver,
    Capybara::Accessible::Adapters::Selenium,
    app,
  )
end

Capybara.register_driver :accessible_selenium do |app|
  require 'capybara/accessible/adapters/selenium'
  Capybara::Accessible.create_driver(
    Capybara::Selenium::Driver,
    Capybara::Accessible::Adapters::Selenium,
    app,
  )
end

Capybara.register_driver :accessible_selenium_chrome do |app|
  require 'capybara/accessible/adapters/selenium'
  Capybara::Accessible.create_driver(
    Capybara::Selenium::Driver,
    Capybara::Accessible::Adapters::Selenium,
    app,
    :browser => :chrome
  )
end

Capybara.register_driver :accessible_poltergeist do |app|
  require 'capybara/accessible/adapters/poltergeist'
  Capybara::Accessible.create_driver(
    Capybara::Poltergeist::Driver,
    Capybara::Accessible::Adapters::Poltergeist,
    app,
  )
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capybara-accessible-0.3.0 lib/capybara/accessible.rb