Class: Lebowski::Foundation::Views::TextFieldView
- Inherits:
-
View
- Object
- ProxyObject
- SCObject
- View
- Lebowski::Foundation::Views::TextFieldView
- Defined in:
- lib/lebowski/foundation/views/text_field.rb
Overview
Represents a proxy to a SproutCore text field view (SC.TextFieldView)
Constant Summary
- SELECTOR_INPUT_FIELD =
"input"- SELECTOR_TEXT_AREA =
"textarea"
Constants included from Mixins::StallSupport
Mixins::StallSupport::DEFAULT_KEY_STALLS, Mixins::StallSupport::DEFAULT_STALL
Constants included from Lebowski::Foundation
SC_BRANCH_CLOSED, SC_BRANCH_OPEN, SC_BUTTON1_STATUS, SC_BUTTON2_STATUS, SC_BUTTON3_STATUS, SC_LEAF_NODE, SC_MIXED_STATE, SC_PICKER_FIXED, SC_PICKER_MENU, SC_PICKER_POINTER, SC_T_ARRAY, SC_T_BOOL, SC_T_CLASS, SC_T_ERROR, SC_T_FUNCTION, SC_T_HASH, SC_T_NULL, SC_T_NUMBER, SC_T_OBJECT, SC_T_STRING, SC_T_UNDEFINED
Constants included from Mixins::WaitActions
Mixins::WaitActions::DEFAULT_TIMEOUT
Instance Attribute Summary
Attributes inherited from ProxyObject
#driver, #name, #parent, #rel_path
Instance Method Summary (collapse)
- - (Object) clear
-
- (Boolean) empty?
Used to check if this view is empty.
- - (Object) key_down(char)
- - (Object) key_up(char)
-
- (Object) type(text)
Used to type text into this view.
- - (Object) type_append(text)
-
- (Object) type_key(text)
Used to simulate the typing of a single key.
- - (Object) type_key_append(text)
-
- (Object) type_keys(text)
Used to simulate the typing of some given text.
- - (Object) type_keys_append(text)
Methods inherited from View
#abs_path, #action_locator_args, #action_target, #assigned_layer_id?, #child_views, #core_query, #frame, #height, #layer, #layer_id, #position, #scroll_to_visible, #scrollable_parent_view, #width
Methods included from Mixins::DelegateSupport
Methods included from Mixins::UserActions
#basic_click, #click, #click_at, #double_click, #double_click_at, #drag, #drag_after, #drag_before, #drag_on_to, #drag_to, #drag_to_end_of, #drag_to_start_of, #focus, #mouse_down, #mouse_down_at, #mouse_move, #mouse_move_at, #mouse_up, #mouse_up_at, #mouse_wheel_delta_x, #mouse_wheel_delta_y, #right_click, #right_click_at, #right_mouse_down, #right_mouse_down_at, #right_mouse_up, #right_mouse_up_at
Methods included from Mixins::StallSupport
adjust_all_stalls, adjust_default_key_stall, adjust_default_stall, reset, #stall
Methods included from Mixins::KeyCheck
Methods included from Mixins::PositionedElement
#height, #position, #position_relative_to, #scroll_to_visible, #width
Methods inherited from SCObject
#has_represented_sc_class?, #kind_of_represented_sc_class?, represented_sc_class, #represented_sc_class, representing_sc_class
Methods inherited from ProxyObject
#==, #[], #abs_path, #abs_path_with, #define, #define_proxy, #init_ext, #initialize, #method_missing, #none?, #object?, #proxy, #represent_as, #sc_all_classes, #sc_class, #sc_guid, #sc_kind_of?, #sc_path_defined?, #sc_type_of, #unravel_relative_path
Methods included from Mixins::DefinePathsSupport
#define_path, #define_paths_for, #defined_path, #defined_paths, #path_defined?, #root_defined_path_part, #root_defined_path_part=
Methods included from Mixins::WaitActions
Constructor Details
This class inherits a constructor from Lebowski::Foundation::ProxyObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Lebowski::Foundation::ProxyObject
Instance Method Details
- (Object) clear
28 29 30 |
# File 'lib/lebowski/foundation/views/text_field.rb', line 28 def clear() type "" end |
- (Boolean) empty?
Used to check if this view is empty
23 24 25 26 |
# File 'lib/lebowski/foundation/views/text_field.rb', line 23 def empty?() val = self['value'] return (val.nil? or val.empty?) end |
- (Object) key_down(char)
32 33 34 35 36 37 |
# File 'lib/lebowski/foundation/views/text_field.rb', line 32 def key_down(char) cq = core_query(text_field_selector) input = cq[0] input.key_down char cq.done end |
- (Object) key_up(char)
39 40 41 42 43 44 |
# File 'lib/lebowski/foundation/views/text_field.rb', line 39 def key_up(char) cq = core_query(text_field_selector) input = cq[0] input.key_up char cq.done end |
- (Object) type(text)
Used to type text into this view. This will directly insert the text into the input field. There will be no simulated key up and key down events
51 52 53 54 55 56 |
# File 'lib/lebowski/foundation/views/text_field.rb', line 51 def type(text) cq = core_query(text_field_selector) input = cq[0] input.type text cq.done end |
- (Object) type_append(text)
58 59 60 61 |
# File 'lib/lebowski/foundation/views/text_field.rb', line 58 def type_append(text) val = self['value'] type "#{val}#{text}" end |
- (Object) type_key(text)
Used to simulate the typing of a single key. This will cause a simulated key up and key down event
67 68 69 70 |
# File 'lib/lebowski/foundation/views/text_field.rb', line 67 def type_key(text) clear type_key_append text end |
- (Object) type_key_append(text)
72 73 74 75 76 77 |
# File 'lib/lebowski/foundation/views/text_field.rb', line 72 def type_key_append(text) cq = core_query(text_field_selector) input = cq[0] input.type_key text cq.done end |
- (Object) type_keys(text)
Used to simulate the typing of some given text. Each character from the given text will "typed" meaning that a simulated key up and key down event will occur for each character. This is useful when you have something that reacts to each character being entered.
85 86 87 88 |
# File 'lib/lebowski/foundation/views/text_field.rb', line 85 def type_keys(text) clear type_keys_append text end |
- (Object) type_keys_append(text)
90 91 92 93 94 95 96 97 |
# File 'lib/lebowski/foundation/views/text_field.rb', line 90 def type_keys_append(text) cq = core_query(text_field_selector) input = cq[0] text.chars.each do |x| input.type_key x end cq.done end |