Sha256: f32ffc80dd0db87c2e92493443e65f9ca5b649dba4092f51b525024ae7a071ef

Contents?: true

Size: 974 Bytes

Versions: 4

Compression:

Stored size: 974 Bytes

Contents

require 'rutl/interface/base_interface'

#
# Interface-level code for fake browser.
#
class NullInterface < BaseInterface
  def initialize
    context = 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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rutl-0.3.0 lib/rutl/interface/null_interface.rb
rutl-0.2.1 lib/rutl/interface/null_interface.rb
rutl-0.2.0 lib/rutl/interface/null_interface.rb
rutl-0.1.4 lib/rutl/interface/null_interface.rb