lib/calabash-cucumber/keyboard_helpers.rb in calabash-cucumber-0.9.169.pre2 vs lib/calabash-cucumber/keyboard_helpers.rb in calabash-cucumber-0.9.169.pre5

- old
+ new

@@ -1,14 +1,17 @@ require 'calabash-cucumber/core' require 'calabash-cucumber/tests_helpers' require 'calabash-cucumber/playback_helpers' require 'calabash-cucumber/environment_helpers' +require 'calabash-cucumber/utils/logging' module Calabash module Cucumber module KeyboardHelpers + include Calabash::Cucumber::TestsHelpers + include Calabash::Cucumber::Logging KEYPLANE_NAMES = { :small_letters => 'small-letters', :capital_letters => 'capital-letters', :numbers_and_punctuation => 'numbers-and-punctuation', @@ -738,22 +741,22 @@ # returns the the text in the first responder # # the first responder will be the +UITextField+ or +UITextView+ instance # that is associated with the visible keyboard. # - # returns +nil+ if there no +textField+ or +testView+ is found to be - # the first responder. it is extremely unlikely that this will happen. + # returns +empty string+ if no +textField+ or +textView+ elements are found to be + # the first responder. # # raises an exception if there is no visible keyboard def _text_from_first_responder raise 'there must be a visible keyboard' unless keyboard_visible? ['textField', 'textView'].each do |ui_class| res = query("#{ui_class} isFirstResponder:1", :text) return res.first unless res.empty? end #noinspection RubyUnnecessaryReturnStatement - return nil + return "" end end end end