Sha256: 2324ef7cf425e82aa107d5799dd402a3ff930b2d0fadf01cd527d20b95f9c128

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'rutl/interface/base'

module RUTL
  module Interface
    #
    # Interface-level code for fake browser.
    #
    class Null < Base
      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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rutl-0.6.0 lib/rutl/interface/null.rb