Class: AX::TextArea

Inherits:
Element show all
Includes:
Accessibility::TextHighlighter
Defined in:
lib/ax/text_area.rb

Overview

Represents a generic text field on screen that users can manipulate. Usually seen in form with placeholder text.

Instance Method Summary collapse

Methods inherited from Element

#==, #actions, #ancestor, #ancestry, #application, #attribute, #attributes, #blank?, #bounds, #children, #description, #initialize, #inspect, #inspect_subtree, #invalid?, #method_missing, #methods, #parameterized_attribute, #parameterized_attributes, #perform, #pid, #respond_to?, #search, #set, #size_of, #to_h, #to_point, #to_s, #type, #writable?

Methods included from Accessibility::PrettyPrinter

#pp_checkbox, #pp_children, #pp_enabled, #pp_focused, #pp_identifier, #pp_position

Constructor Details

This class inherits a constructor from AX::Element

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AX::Element

Instance Method Details

#highlight_text(range) ⇒ Object

Note:

The implementation of this code makes assumptions about the minimum size of text and may not work with very small fonts.

Highlights text in the field/area that matches the given text

The given text can be a String, Range, or Regexp that matches some range of text in the receiver. An exception will be raised if the text is not valid for any reason.

Examples:


text_field.highlight_text(0..5); type "\\DELETE"
text_area.highligtht_text("W"); type "W"
text_field.highlight_text(/is a lie?/i); type "is delicious and moist"

Parameters:

  • text (String, Regexp, Range)


11
12
13
14
# File 'lib/ax/text_area.rb', line 11

def highlight_text range
  # @todo make sure the text is visible first
  super
end