Sha256: 0024118e59eb186ba1645a1d4284b935c4a939ac8384ff6fa0ca487ed82187d2

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'rutl/interface/base_interface'

module RUTL
  #
  # Interface-level code for fake browser.
  #
  class NullInterface < BaseInterface
    def initialize
      context = RUTL::Element::ElementContext.new(destinations: nil,
                                   interface: self,
                                   selectors: [])
      @driver = NullDriver.new(context)
      super
    end

    # The null driver needs to talk to the null interface.
    # Other driver/interface relations are not like this.
    attr_writer :current_page

    def current_page
      # Default to @pages.first if not set?
      # A browser can always check its current URL but the null driver can't.
      @current_page ||= @pages.first
    end

    def wait_for_transition(destinations)
      # TODO: Setting @current page didn't do it beacause that set
      # context.interface.current_page and we wanted this in the browser.
      @current_page = destinations.first.new(self)
      $browser.current_page = @current_page
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rutl-0.5.0 lib/rutl/interface/null_interface.rb
rutl-0.4.0 lib/rutl/interface/null_interface.rb