Sha256: 5491ea3387148640b852511e25c22ed458da3f643192f8413ec7e9c8f7d93e63

Contents?: true

Size: 1.87 KB

Versions: 1

Compression:

Stored size: 1.87 KB

Contents

module Calabash

  # A public API for entering text.
  # @!visibility private
  module Text
    # Enter `text` into the currently focused view.
    #
    # @param [String] text The text to type.
    # @raise [RuntimeError] if the text cannot be typed.
    def enter_text(text)
      _enter_text(text.to_s)
    end

    # Enter `text` into `query`.
    # @see Calabash::Text#enter_text
    #
    # @param [String] text The text to type.
    # @param query A query describing the view to enter text into.
    def enter_text_in(query, text)
      _enter_text_in(query, text)
    end

    # Clears the text of the currently focused view.
    def clear_text
      _clear_text
    end

    # Clears the text `view`
    # @see Calabash::Text#clear_text
    #
    # @param query A query describing the view to clear text in.
    def clear_text_in(query)
      _clear_text_in(query)
    end

    # @todo add docs
    def tap_current_keyboard_action_key
      _tap_current_keyboard_action_key
    end

    # Escapes single quotes in `string`.
    #
    # @example
    #   > escape_quotes("Let's get this done.")
    #   => "Let\\'s get this done."
    # @param [String] string The string to escape.
    # @return [String] A string with its single quotes properly escaped.
    def escape_single_quotes(string)
      Text.escape_single_quotes(string)
    end

    # @!visibility private
    def _enter_text(text)
      abstract_method!
    end

    # @!visibility private
    def _enter_text_in(view, text)
      abstract_method!
    end

    # @!visibility private
    def _clear_text
      abstract_method!
    end

    # @!visibility private
    def _clear_text_in(view)
      abstract_method!
    end

    # @!visibility private
    def _tap_current_keyboard_action_key
      abstract_method!
    end

    # @!visibility private
    def self.escape_single_quotes(string)
      string.gsub("'", "\\\\'")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
calabash-1.9.9.pre3 lib/calabash/text.rb