Skip to content

Commit

Permalink
Reorder iOS text methods
Browse files Browse the repository at this point in the history
  • Loading branch information
bootstraponline committed Apr 28, 2014
1 parent ead35f9 commit 6e215ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
33 changes: 17 additions & 16 deletions lib/appium_lib/ios/element/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
module Appium
module Ios
UIAStaticText = 'UIAStaticText'
# Get an array of text elements.
# @return [Array<Text>]
def e_s_texts
tags UIAStaticText

# Get the first element that includes text.
# @param value [String, Integer] the value to find. If int then the text at that index is returned.
# @return [Text]
def s_text value
return ele_index :text, value if value.is_a? Numeric
xpath_visible_contains UIAStaticText, value
end

def s_texts value
xpaths_visible_contains UIAStaticText, value
end

# Get the first text element.
Expand All @@ -20,18 +27,6 @@ def last_s_text
last_ele UIAStaticText
end

# Get the first element that includes text.
# @param value [String, Integer] the value to find. If int then the text at that index is returned.
# @return [Text]
def s_text value
return ele_index :text, value if value.is_a? Numeric
xpath_visible_contains UIAStaticText, value
end

def s_texts value
xpaths_visible_contains UIAStaticText, value
end

# Get the first textfield that matches text.
# @param value [String] the value that the tag must match
# @return [Text]
Expand All @@ -45,5 +40,11 @@ def s_text_exact value
def s_texts_exact value
xpaths_visible_exact UIAStaticText, value
end

# Get an array of text elements.
# @return [Array<Text>]
def e_s_texts
tags UIAStaticText
end
end # module Common
end # module Appium
4 changes: 4 additions & 0 deletions lib/appium_lib/ios/element/textfield.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module Ios
UIATextField = 'UIATextField'
UIASecureTextField = 'UIASecureTextField'

private

# @private
def _textfield_visible_string opts={}
index = opts.fetch :index, false
Expand All @@ -27,6 +29,8 @@ def _textfield_contains_string value
"#{textfield} | #{secure}"
end

public

# Get the first textfield that matches text.
# @param value [String, Integer] the text to match exactly. If int then the textfield at that index is returned.
# @return [Textfield]
Expand Down

0 comments on commit 6e215ff

Please sign in to comment.